nsf / termbox

Library for writing text-based user interfaces

Home Page:http://code.google.com/p/termbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESC considered to be F1 in keyboard events

QingYun opened this issue · comments

Hi! I'm new here and I'm trying to make the output demo work in a GNOME terminal. The while loop in the main function clearly shows that it should exit when the ESC key is pressed, but it doesn't work. I always get a 0xFFFF as ev.key instead of TB_KEY_ESC.

I believe the problem is in the extract_event, which calls parse_escape_seq when the first character of the input buffer is ESC. The parse_escape_seq will then find this single-character buffer matches the first sequence in the keys array, which is F1.

I added a len > 1 condition above the call to parse_escape_seq as a workaround. Not sure if I've done anything wrong as such a fundamental feature should be broken.

commented

I probably should revert this patch: 6dfe8a0

Right? What do you think?

commented

Sorry for applying that patch without properly testing it.