On 2008-04-18, Paul LeoNerd Evans <[EMAIL PROTECTED]> wrote: > On Thu, Apr 17, 2008 at 06:20:02PM -0700, Gary Johnson wrote: > > On 2008-04-17, Paul LeoNerd Evans <[EMAIL PROTECTED]> wrote: > > > Besides which, it was my understanding that terminfo/termcap really > > > don't have very much to say about keyboard input at all. If you're > > > lucky, they say "Oh, by the way, the <Down> key might send this > > > sequence" and you're on your own to match it. > > > > That is incorrect. The terminfo database contains the definitions > > of a lot of keys. See "man terminfo" and look at the output of > > "infocmp xterm. The getch() function in libraries such as ncurses > > interpret the character sequences corresponding to those keys and > > return values such as KEY_DOWN, KEY_UP, etc. See "man ncurses" and > > "man curs_getch". > > OK.. so we have > > int getch(void); > > Please explain the part about that which tells me about the > Shift/Ctrl/Alt modifiers that were held along with the key?
I believe the idea of terminfo is to have symbols for keys' functions, not how you pressed them, i.e., to separate function from mechanism. Type the ; key, getch() returns ';'. Hold the Shift key and type the ; key, getch() returns ':' (on my keyboard), not some code for Shift-;. > Furthermore, explain where in termcap/terminfo I can find any hint of > knowledge about modifiers? Again, I believe the absence of knowledge about modifiers is by design. The application should care only about the key's function, not what the user had to do on any particular keyboard to get that function. Terminfo/curses presents a higher-level abstraction of a keyboard than your library does. That abstraction has some limits. Your abstraction has benefits and costs, which are certainly worth discussing. For the present, I just wanted to correct the notion that terminfo/curses doesn't handle keyboard input well. Regards, Gary --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
