Skip to content
Myr

Wait for additional keys after ESC for up to 100ms

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #661

authored by Junegunn Choi · committed by Junegunn Choi · parent 4accc69 · Browse files · 1 file+11 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−0 removed

  • other:+11 added−0 removed

1 file+11 added−0 removed

modified:src/tui/ncurses.go+11 added
293 unmodified lines
294}295296func GetBytes() []byte {297 c := getch(false)298 retries := 0299 if c == 27 {300 // Wait for additional keys after ESC for 100ms (10 * 10ms)301 retries = 10302 }303 _buf = append(_buf, byte(c))304305 for {306 c = getch(true)307 if c == -1 {308 if retries > 0 {309 retries--310 time.Sleep(10 * time.Millisecond)311 continue312 }313 break314 }315 retries = 0316 _buf = append(_buf, byte(c))317 }318319 return _buf
209 unmodified lines