nsf / termbox

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

Can't read Alt key in TB_INPUT_ESC mode #44

Closed gchp closed 9 years ago

gchp commented 9 years ago

Is it possible to read the Alt key when not in INPUT_ALT mode?

Using the keyboard demo, pressing Alt+f for example only highlights the f key, unless I change to TB_INPUT_ALT mode, where the same key sequence highlights both keys.

I need to be able to get normal Esc behaviour, and still use the Alt key. Is this possible? Could just be missing something simple here.

nsf commented 9 years ago

It's impossible, because terminals use the same sequence of bytes for esc and for alt (at least that's the setup most people use). That's why there are input modes, because you can't have both.

It's possible to have both on windows, but for the sake of providing a portable set of behaviour, windows implementation emulates terminals.

nsf commented 9 years ago

Oh, sorry, I thought it was the question in termbox-go, which has windows implementation. In C version of the termbox it's even simpler. There is no windows implementation. :D

gchp commented 9 years ago

Ok, grand. Thanks for the response! Just wanted to make sure I wasn't missing something :)