• Overriding InputLine keystrokes

    From Codefenix@VERT/CONCHAOS to All on Thursday, February 13, 2025 10:54:12
    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.

    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.

    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? If not, I think I can live with defining alternate keys, but was hoping to keep the feature and usage parity as close as possible to the other client.

    |15 þ ù ú codefenix ú ù ú ConstructiveChaos BBS ú ú ù þ þ
    |08 þ þ ù (https/telnet/ssh)://conchaos.synchro.net ú ù þ
    |07

    ...That must be wonderful! I don't understand it at all.
    ---
    þ Synchronet þ -=[ ConstructiveChaos BBS | conchaos.synchro.net ]=-
  • From Digital Man@VERT to Codefenix on Thursday, February 13, 2025 10:10:04
    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
  • From Codefenix@VERT/CONCHAOS to Digital Man on Thursday, February 13, 2025 14:04:52
    Re: Overriding InputLine keystrokes
    By: Digital Man to Codefenix on Thu Feb 13 2025 10:10 am

    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.

    Ah, ok, that does make sense.

    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.

    Fair enough. :)

    These are "nice to haves" and not really strong needs, so I'll avoid rocking the inputline boat, at least for now.

    Thanks!

    |15 þ ù ú codefenix ú ù ú ConstructiveChaos BBS ú ú ù þ þ
    |08 þ þ ù (https/telnet/ssh)://conchaos.synchro.net ú ù þ
    |07

    ...The unnatural, that too is natural.
    ---
    þ Synchronet þ -=[ ConstructiveChaos BBS | conchaos.synchro.net ]=-