diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2016-11-08 03:07:26 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2016-11-08 03:07:26 +0900 |
| commit | d206949f6258db36060af3e84fdae15cb7b9a45c (patch) | |
| tree | 31aa4a49b9e162d2ed672212fd820c9cb8e782df /src | |
| parent | 4accc6902212fde0bf4fa53e1dbe4de96978a11a (diff) | |
| download | fzf-d206949f6258db36060af3e84fdae15cb7b9a45c.tar.gz | |
Wait for additional keys after ESC for up to 100ms
Close #661
Diffstat (limited to 'src')
| -rw-r--r-- | src/tui/ncurses.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tui/ncurses.go b/src/tui/ncurses.go index d55c1c87..16a29fc3 100644 --- a/src/tui/ncurses.go +++ b/src/tui/ncurses.go @@ -295,13 +295,24 @@ func getch(nonblock bool) int { func GetBytes() []byte { c := getch(false) + retries := 0 + if c == 27 { + // Wait for additional keys after ESC for 100ms (10 * 10ms) + retries = 10 + } _buf = append(_buf, byte(c)) for { c = getch(true) if c == -1 { + if retries > 0 { + retries-- + time.Sleep(10 * time.Millisecond) + continue + } break } + retries = 0 _buf = append(_buf, byte(c)) } |
