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

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Tue, 10 Sep 2013 21:11:08 +0100

Hi Mitchell,

On Thu, Aug 29, 2013 at 11:58:00AM -0400, Mitchell wrote:
> 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.

I've been thinking about this key input/translation thing.

Another annoyance I've noticed is that I think keys can get lost when
swapping between normal input and command_entry. For example, I have ':'
mapped to start a command_entry mode - if I type the sequence ':b foo' too
quickly, the 'b foo' won't end up in the command_entry. I think the same
happens on the way out. I can reproduce this easily by pasting a string in,
but it happens fairly regularly with my normal typing too, causing me to have
to break my frenzied flow to backspace and start again more slowly.

Anyway, I think (I haven't proved it, but it seems plausible and likely) that
this is due to termkey and the curses input (used by CDKEntry) having separate
input buffers. So in the example above, termkey's read the whole ':b foo'
sequence (or in real life, maybe ':b f') from stdin, so curses never sees it.
So my conclusion is that both textadept's main loop and the CDKEntry need to
have common key input.

On a related subject, I'm trying out switching from termkey_waitkey() in the
main loop to a combination of select()/termkey_advisereadable()/
termkey_getkey(). The advantage being that it then becomes possible to add
functionality similar to lspawn (and _G.timeout()) in curses! Which means I
probably want to modify CDK to get its input the same way rather than calling
wgetch(), and having the translation happen separately.

(I've finished, phew)

Regards,

Chris

-- 
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 Tue 10 Sep 2013 - 16:11:08 EDT

This archive was generated by hypermail 2.2.0 : Wed 11 Sep 2013 - 06:52:40 EDT