Skip to content

Commit ba57149

Browse files
committed
Fix REPL's prev line capturing
1 parent 016d183 commit ba57149

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/debug/local.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,22 @@ def tui?
130130
true
131131
end
132132

133+
def store_prev_line(line)
134+
@prev_line = line
135+
end
136+
133137
def store_tui_data(data)
134138
@ui_data = data
135139
end
136140

137141
def puts str = nil
138142
@screen.draw_windows(@ui_data)
143+
144+
if @prev_line
145+
@screen.draw_repl(@prev_line)
146+
@prev_line = nil
147+
end
148+
139149
@screen.draw_repl(str)
140150
@screen.render!
141151
end

lib/debug/session.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ def process_command line
404404
@repl_prev_line = line
405405
end
406406

407+
if @ui.tui?
408+
@ui.store_prev_line("#{prompt}#{@repl_prev_line}")
409+
end
410+
407411
/([^\s]+)(?:\s+(.+))?/ =~ line
408412
cmd, arg = $1, $2
409413

@@ -1773,10 +1777,7 @@ def after_fork_parent
17731777
end
17741778

17751779
def capture_tui_data(tui_data)
1776-
if tui_data
1777-
tui_data[:repl] = "#{prompt}#{@repl_prev_line}"
1778-
@ui.store_tui_data(tui_data)
1779-
end
1780+
@ui.store_tui_data(tui_data) if tui_data
17801781
end
17811782

17821783
SUPPORTED_WINDOWS = {

0 commit comments

Comments
 (0)