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

From: Mitchell <m.att.foicica.com>
Date: Thu, 29 Aug 2013 09:49:42 -0400 (EDT)

Hi Chris,

On Thu, 29 Aug 2013, Chris Emerson wrote:

> Hi,
>
> I'm trying to implement some history in my command_entry mode and wondering
> why my handler for 'up', 'down', 'cp', etc. weren't being called.
>
> The problem is that the events are (nearly) raw Curses events KEY_UP,
> KEY_DOWN, etc. which weren't in the KEYSYMS table.
>
> I could add the extra curses keys to the KEYSYMS table. At the moment (I guess
> by luck), it seems that none of the Curses, Scintilla, or GDK key codes have
> overlaps. Should there instead be mappings from curses (and GDK) keys to
> Scintilla keys before they get to Lua?

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.

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.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 29 Aug 2013 - 09:49:42 EDT

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