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) {
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working 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..
Thanks.