Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bracketed paste and scrolling bug #801

Merged
merged 2 commits into from
Jan 5, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix set_pasting_state bug with bracketed paste
  • Loading branch information
tompng committed Jan 2, 2025
commit c52bd22bb105eb638ce88289053d7d6d5e3c87d0
3 changes: 1 addition & 2 deletions lib/reline.rb
Original file line number Diff line number Diff line change
@@ -341,7 +341,6 @@ def readline(prompt = '', add_hist = false)
line_editor.set_signal_handlers
loop do
read_io(config.keyseq_timeout) { |inputs|
line_editor.set_pasting_state(io_gate.in_pasting?)
inputs.each do |key|
case key.method_symbol
when :bracketed_paste_start
@@ -350,14 +349,14 @@ def readline(prompt = '', add_hist = false)
when :quoted_insert, :ed_quoted_insert
key = Reline::Key.new(io_gate.read_single_char(config.keyseq_timeout), :insert_raw_char)
end
line_editor.set_pasting_state(io_gate.in_pasting?)
line_editor.update(key)
end
}
if line_editor.finished?
line_editor.render_finished
break
else
line_editor.set_pasting_state(io_gate.in_pasting?)
line_editor.rerender
end
end
8 changes: 8 additions & 0 deletions test/reline/yamatanooroti/test_rendering.rb
Original file line number Diff line number Diff line change
@@ -550,6 +550,14 @@ def test_bracketed_paste
prompt> 3
prompt> end
EOC
write("\e[200~.tap do\r\t4\r\t5\rend\e[201~")
assert_screen(<<~EOC)
prompt> 3
prompt> end.tap do
prompt> 4
prompt> 5
prompt> end
EOC
close
end