mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Process Backspace key in incremental search correctly
This commit is contained in:
parent
e15b0313a7
commit
c7f05310a2
1 changed files with 3 additions and 3 deletions
|
@ -1159,7 +1159,7 @@ class Reline::LineEditor
|
||||||
loop do
|
loop do
|
||||||
key = Fiber.yield(search_word)
|
key = Fiber.yield(search_word)
|
||||||
case key
|
case key
|
||||||
when "\C-h".ord, 127
|
when "\C-h".ord, "\C-?".ord
|
||||||
grapheme_clusters = search_word.grapheme_clusters
|
grapheme_clusters = search_word.grapheme_clusters
|
||||||
if grapheme_clusters.size > 0
|
if grapheme_clusters.size > 0
|
||||||
grapheme_clusters.pop
|
grapheme_clusters.pop
|
||||||
|
@ -1217,7 +1217,7 @@ class Reline::LineEditor
|
||||||
@searching_prompt = "(reverse-i-search)`': "
|
@searching_prompt = "(reverse-i-search)`': "
|
||||||
@waiting_proc = ->(k) {
|
@waiting_proc = ->(k) {
|
||||||
case k
|
case k
|
||||||
when "\C-j".ord, "\C-?".ord
|
when "\C-j".ord
|
||||||
if @history_pointer
|
if @history_pointer
|
||||||
@line = Reline::HISTORY[@history_pointer]
|
@line = Reline::HISTORY[@history_pointer]
|
||||||
else
|
else
|
||||||
|
@ -1237,7 +1237,7 @@ class Reline::LineEditor
|
||||||
@cursor = @byte_pointer = 0
|
@cursor = @byte_pointer = 0
|
||||||
else
|
else
|
||||||
chr = k.is_a?(String) ? k : k.chr(Encoding::ASCII_8BIT)
|
chr = k.is_a?(String) ? k : k.chr(Encoding::ASCII_8BIT)
|
||||||
if chr.match?(/[[:print:]]/) or k == "\C-h".ord or k == 127
|
if chr.match?(/[[:print:]]/) or k == "\C-h".ord or k == "\C-?".ord
|
||||||
searcher.resume(k)
|
searcher.resume(k)
|
||||||
else
|
else
|
||||||
if @history_pointer
|
if @history_pointer
|
||||||
|
|
Loading…
Reference in a new issue