mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-01 20:52:06 -07:00
Proper handling of typeahead arrow keys
To reproduce: `sleep 2; fzf` and press arrow keys
This commit is contained in:
23
fzf
23
fzf
@@ -142,7 +142,7 @@ class FZF
|
|||||||
def start
|
def start
|
||||||
$stdout.reopen($stderr)
|
$stdout.reopen($stderr)
|
||||||
|
|
||||||
render { init_screen }
|
init_screen
|
||||||
start_reader
|
start_reader
|
||||||
start_renderer
|
start_renderer
|
||||||
start_search
|
start_search
|
||||||
@@ -531,6 +531,8 @@ class FZF
|
|||||||
end | (bold ? C::A_BOLD : 0)
|
end | (bold ? C::A_BOLD : 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
C.refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_reader
|
def start_reader
|
||||||
@@ -819,13 +821,20 @@ class FZF
|
|||||||
end
|
end
|
||||||
when 27
|
when 27
|
||||||
C.stdscr.timeout = 0
|
C.stdscr.timeout = 0
|
||||||
ch =
|
ch = # Typeahead arrow keys
|
||||||
case ch2 = C.getch
|
case ch2 = C.getch
|
||||||
when 'b' then :alt_b
|
when '[', 91
|
||||||
when 'f' then :alt_f
|
case ch3 = C.getch
|
||||||
when nil then :esc
|
when 'D', 68 then ctrl(:b)
|
||||||
else
|
when 'C', 67 then ctrl(:f)
|
||||||
ch2
|
when 'B', 66 then ctrl(:j)
|
||||||
|
when 'A', 65 then ctrl(:k)
|
||||||
|
else ch3
|
||||||
|
end
|
||||||
|
when 'b', 98 then :alt_b
|
||||||
|
when 'f', 102 then :alt_f
|
||||||
|
when nil then :esc
|
||||||
|
else ch2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user