Emacs key bindings

Posted on
  • Hi,
    I would like to request emacs key bindings be added (to the firmware I guess) if possible.. My hands are pretty hard wired for ctrl-a, ctrl-d, ctrl-e and ctrl-w these days so remembering to hit home, end, del etc instead hurts :)

    I had a go at implementing it, but I can't do a build myself (the link for the Hy Mini 2.4 target says it can't find ctr0.o).

    Here's my prototype diff..

    diff --git a/src/jsinteractive.c b/src/jsinteractive.c
    index b4de355..0d5a465 100644
    --- a/src/jsinteractive.c
    +++ b/src/jsinteractive.c
    @@ -912,6 +912,12 @@ void jsiHandleChar(char ch) {
       // jsiConsolePrintf("[%d:%d]\n", inputState, ch);
       //
       // special stuff
    +  // 1 - Ctrl-a - beginning of line
    +  // 4 - Ctrl-d - backwards delete
    +  // 5 - Ctrl-e - end of line
    +  // 21 - Ctrl-u - delete line
    +  // 23 - Ctrl-w - delete word (currently just does the same as Ctrl-u)
    +  //
       // 27 then 91 then 68 - left
       // 27 then 91 then 67 - right
       // 27 then 91 then 65 - up
    @@ -929,6 +935,14 @@ void jsiHandleChar(char ch) {
    
       if (ch == 0) {
         inputState = IS_NONE; // ignore 0 - it's scary
    +  } else if (ch == 1) { // Ctrl-a
    +    jsiHandleHome();
    +  } else if (ch == 4) { // Ctrl-d
    +      jsiHandleDelete(false/*not backspace*/);
    +  } else if (ch == 5) { // Ctrl-e
    +    jsiHandleEnd();
    +  } else if (ch == 21 || ch == 23) { // Ctrl-u or Ctrl-w
    +      jsiClearInputLine();
       } else if (ch == 27) {
         inputState = IS_HAD_27;
       } else if (inputState==IS_HAD_27) {
    

    Thanks.

  • Hi - thanks for posting this up...

    Was it you as DanielO that put this on GitHub as a pull request? Probably best to talk about it on there? I'm happy to get them added but I think we ought to get them doing what people expect :)

    I think we'll also need some changes to the Web IDE's terminal too...

  • Yeah, I posted it here first because I couldn't get my tree to build. Subsequently I fixed it so I could test the patch and the submitted it on github.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Emacs key bindings

Posted by Avatar for Darius @Darius

Actions