nsf / termbox

Library for writing text-based user interfaces
http://code.google.com/p/termbox
MIT License
1.96k stars 185 forks source link

Delayed ESC event in INPUT_ESC mode #107

Closed photm5 closed 6 years ago

photm5 commented 6 years ago

Even though I use INPUT_ESC mode (and thus assume no special behaviour for the Escape key), the Escape key event takes longer than other keys.

To reproduce, run this code in a python3 REPL:

import termbox
tb = termbox.Termbox(); tb.select_input_mode(termbox.INPUT_ESC); tb.poll_event(); tb.close()

Upon pressing any key, termbox will exit quickly; but when pressing Escape, it takes a bit longer.

I checked how fast vim responds (it is almost instantaneous), so I assume this should be possible. (I hope they didn't apply insane hackery.) Edit: I did that check by opening a new terminal and running vim in it; as I just found out, vim responds slowly too when run inside of tmux. See my comment below.

photm5 commented 6 years ago

If you type a non-Escape key just after Escape, it reacts instantly. To reproduce, run the code above, and press ESC a or sth. similar.

nsf commented 6 years ago

What OS and terminal? I don't think termbox does any kind of waiting. It's up to a terminal to send the ESC byte or to wait.

photm5 commented 6 years ago

Oops, sorry for the long delay! I use urxvt on NixOS. Interesting, I just tried to reproduce this again to double-check, and it only happens in tmux! So this might be a tmux bug then?

photm5 commented 6 years ago

Ah, it's not a bug, it's a feature. Doesn't happen if I put set -s escape-time 0 in my ~/.tmux.conf.

Thanks for your helpful reply! :)