Re: [code] [textadept] Key mapping in command_entry

From: Mitchell <>
Date: Thu, 29 Aug 2013 11:58:00 -0400 (Eastern Daylight Time)


On Thu, 29 Aug 2013, Chris Emerson wrote:

> Hi Mitchell,
> On Thu, Aug 29, 2013 at 09:49:42AM -0400, Mitchell wrote:
>> You will see in src/textadept.c's `main()` function you will see how
>> keys are handled in the main view (not the command entry). There are
>> tables and complicated "if" statements. All of that results in
>> sending the proper SCK_* keys that are in core/keys.lua's `KEYSYMS`
>> table.
> Right, I see. Some of it goes via termkey.
>> Now look at src/textadept.c's `c_keypress()` function in the CURSES
>> #ifdef (around line 547). There is very little interpretation of
>> curses/pdcurses keys. In short, I've neglected the command entry. I
>> don't remember if this was to save lines of C, if I didn't think
>> handling KEY_UP, KEY_DOWN, and the like was useful (perhaps I
>> thought ^A-^Z was good enough), or both. (It was probably both.)
>> I'm kind of torn on this one, to be honest.
> Any reason not to factor the translation into a separate function to be called
> from both places? (Other than the time and effort)

Well there's the termkey translation and then the raw curses/pdcurses
translation (because CDK calls `c_keypress()`; termkey is not used). The
pdcurses translation could be put into a separate function, but I'd have
to write a new one for regular curses. I'll look into it and get back to
you. Perhaps it's not as bad as I thought.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Thu 29 Aug 2013 - 11:58:00 EDT

This archive was generated by hypermail 2.2.0 : Fri 30 Aug 2013 - 06:35:39 EDT