• Clearing command string

    From Tegularius@VERT/BAUDHOUS to All on Sat Jul 18 15:33:38 2009
    Experimenting with a Java-script using the Major shell, because it
    looks like the simplest, I have inserted this code into the
    :transfers section:

    cmdkey C
    exec "?chgdir"
    setstr ""
    end_cmd

    I am happy to have discovered that, because this shell accepts strings
    rather than single key commands, I can pass a string into the Javascript, avoiding an extra prompt. E.g., typing "CLC" changes the current
    file area as desired. One can even change both the library and the area,
    e.g. "CDOS\AE".

    There's just one problem: when the Major shell accepts its next command,
    the remaining characters of the command string are still there. I was
    expecting the line 'setstr ""' to remove them, but it doesn't. What
    can I do about this?


    ---
    ■ Synchronet ■ The Bauding House - baudhous.synchro.net
  • From Digital Man@VERT to Tegularius on Sat Jul 18 19:40:49 2009
    Re: Clearing command string
    By: Tegularius to All on Sat Jul 18 2009 03:33 pm

    Experimenting with a Java-script using the Major shell, because it
    looks like the simplest, I have inserted this code into the
    :transfers section:

    cmdkey C
    exec "?chgdir"
    setstr ""
    end_cmd

    I am happy to have discovered that, because this shell accepts strings rather than single key commands, I can pass a string into the Javascript, avoiding an extra prompt. E.g., typing "CLC" changes the current
    file area as desired. One can even change both the library and the area, e.g. "CDOS\AE".

    There's just one problem: when the Major shell accepts its next command,
    the remaining characters of the command string are still there. I was expecting the line 'setstr ""' to remove them, but it doesn't. What
    can I do about this?

    You could change the way the script handles multiple input characters:

    It currently uses the "ungetstr" function, which puts keys into the low-level keyboard input buffer and there is no method (in Baja or JavaScript) to clear this keyboard buffer. Adding this support to the JS console object should be trivial, so I'll have a look-see into that.

    digital man

    Snapple "Real Fact" #41:
    Shrimp can only swim backward.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net