Skip to content

Fix incremental search cancel bug - #748

Merged
ima1zumi merged 1 commit into
ruby:masterfrom
tompng:reverse_search_bugfix
Oct 2, 2024
Merged

ima1zumi merged 1 commit into
ruby:masterfrom
tompng:reverse_search_bugfix

Conversation

@tompng

@tompng tompng commented Sep 8, 2024

Copy link
Copy Markdown
Member

Readline restores line, cursor position and history index with "\C-g"(cancel incremental search). Reline should also restore them.
Moving history is difficult. We should use utility method move_history.

Fix incremental search cancel behavior

Input

123\n
456\n
UP
LFET
\C-r
12
\C-g

Expected (Readline, this branch)

irb(main):001> 123
=> 123
irb(main):002> 456
=> 456
irb(main):003> 45|6

Actual

irb(main):001> 123
=> 123
irb(main):002> 456
=> 456
irb(main):003> |123

Fix irb crash

input

1\n
\C-r
1
TAB
\C-r
1
TAB

bug

reline/line_editor.rb:1712:in 'block in Reline::LineEditor#incremental_search_history': undefined method 'split' for nil (NoMethodError)
@buffer_of_lines = line.split("\n")

@ima1zumi ima1zumi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your refactoring and bugfix!

@ima1zumi
ima1zumi merged commit bf0f8fa into ruby:master Oct 2, 2024
@tompng
tompng deleted the reverse_search_bugfix branch October 2, 2024 18:19
@ima1zumi ima1zumi added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants