Re: Overriding InputLine keystrokes
By: Codefenix to All on Thu Feb 13 2025 10:54 am
> I'm working on some more modifications for Synchronet's MRC client. Would
> like to define some "hotkeys" to perform special functions similar to those
> in the Mystic version of the MRC client.
>
> For example, pressing DEL should reset the mention counter and also let the
> user review previous mentions. I currently have KEY_UP handling this
> function, since KEY_DEL is apparently reserved as an alternate backspace key
> if I'm properly understanding the inputline.js library.
Yeah, that looks to be the case:
https://gitlab.synchro.net/main/sbbs/-/blob/master/exec/load/inputline.js?ref_type=heads#L182
You can probably add an argument to that getkey() method to enable special behavior.
> I'd also like KEY_ESC to clear the inputline buffer, so users don't need to
> repeatedly press or hold down backspace to clear the buffer themselves, but
> it would seem that this key isn't handled by inputline at all.
ESC is a bit problematic since ANSI escape sequences (e.g. for arrow keys) begin with the ESC character, so you need to have some kind of guard time to recognize the difference between an ESC key press and the start of an escape sequence.
> I noticed inputline.getkey() takes an optional use_hotkeys boolean, however
> setting this to true turns every key, even alphanumerics, into independent
> hotkeys as well, meaning A does something, B does something, etc., which
> obviously isn't wanted for typing long buffers of text.
>
> Is there way to override or add certain keys as needed?
It's all modifiable. There aren't a lot of users of this library (the author doesn't participate here too often), you mind find more feedback in IRC (#synchronet at irc.synchronet), but generally if your change is backward compatible, a merge request to gitlab.synchro.net would be accepted.
--
digital man (rob)
Synchronet "Real Fact" #65:
Synchronet can dynamically compress and uncompress message bases (using LZH)
Norco, CA WX: 54.7øF, 97.0% humidity, 0 mph SE wind, 0.31 inches rain/24hrs
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net