[Tickit-dev] Tentative Escape key

Paul "LeoNerd" Evans leonerd at leonerd.org.uk
Sun Oct 4 00:17:05 BST 2015


circle-fe-term currently cheats its way around the Tickit.pm internals,
to hook the 'on_key' method to insert some extra logic around Escape
keys. On receipt of an Escape key is draws an "ESC-" indicator, and
suppresses emission of that event for now. If another key arrives
within a timeout period it applies the Alt- modifier. On a timeout it
emits the real Escape key. Either way, it then removes the indicator.

This is handy for working around slow links to terminals (e.g. mobile
data), where the Escape and the letter byte arrive sufficiently slowly
apart that it falls outside the libtermkey 20msec timeout.

It's impossible currently for an application to handle this in the C
library, because it couldn't inject a new key event. A sufficiently
early function bound to TICKIT_EV_KEY on the term instance could
suppress the first Escape key, but it cannot modify the string of the
next keypress event to arrive, nor can it inject another Escape event
on that timeout.

Instead, for the C library, I wonder about adding a new kind KEYEV type:

  TICKIT_KEYEV_TENTATIVE_KEY

The structure would look like a regular TICKIT_KEYEV_KEY. Because it's
a new type, applications not specifically looking out for it would just
ignore it. It would stand to tell the application "if you want to draw
an ESC indicator, do so now". The Term instance itself would then
manage the core logic about it, emitting a real ESCAPE key if required,
or modifying another received key if one comes. The application can
remove its ESC indicator on receipt of a non-tentative key.

How does that sound to people? Is it too subtle? Too special-cased to
the Escape key? Would it be nice to provide visual indication of Escape
key / Alt prefix coalescence to applications? Indeed; is it even a
thing we want to be doing at all?

-----

See also the LP blueprint:

  https://blueprints.launchpad.net/libtickit/+spec/tentative-escape

-- 
Paul "LeoNerd" Evans

leonerd at leonerd.org.uk
http://www.leonerd.org.uk/  |  https://metacpan.org/author/PEVANS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mail.leonerd.org.uk/pipermail/tickit-dev/attachments/20151004/87220247/attachment.sig>


More information about the Tickit-dev mailing list