diff --git a/third_party/linenoise/linenoise.c b/third_party/linenoise/linenoise.c index a4d533e10..62ef23258 100644 --- a/third_party/linenoise/linenoise.c +++ b/third_party/linenoise/linenoise.c @@ -47,6 +47,8 @@ │ ALT-> END OF HISTORY │ │ ALT-F FORWARD WORD │ │ ALT-B BACKWARD WORD │ +│ CTRL-RIGHT FORWARD WORD │ +│ CTRL-LEFT BACKWARD WORD │ │ CTRL-ALT-F FORWARD EXPR │ │ CTRL-ALT-B BACKWARD EXPR │ │ ALT-RIGHT FORWARD EXPR │ @@ -2173,6 +2175,14 @@ ssize_t linenoiseEdit(struct linenoiseState *l, const char *prompt, char **obuf, default: break; } + } else if (rc == 6 && seq[2] == '1' && + seq[3] == ';' && seq[4] == '5') { + switch (seq[5]) { + CASE('C', linenoiseEditRightWord(l)); // \e[1;5C ctrl-right + CASE('D', linenoiseEditLeftWord(l)); // \e[1;5D ctrl-left + default: + break; + } } } else { switch (seq[2]) { diff --git a/tool/net/definitions.lua b/tool/net/definitions.lua index 767e22470..c33411f41 100644 --- a/tool/net/definitions.lua +++ b/tool/net/definitions.lua @@ -108,6 +108,8 @@ KEYBOARD ALT-> END OF HISTORY ALT-F FORWARD WORD ALT-B BACKWARD WORD + CTRL-RIGHT FORWARD WORD + CTRL-LEFT BACKWARD WORD CTRL-K KILL LINE FORWARDS CTRL-U KILL LINE BACKWARDS ALT-H KILL WORD BACKWARDS diff --git a/tool/net/help.txt b/tool/net/help.txt index 61755752d..92230e863 100644 --- a/tool/net/help.txt +++ b/tool/net/help.txt @@ -102,6 +102,8 @@ KEYBOARD ALT-> END OF HISTORY ALT-F FORWARD WORD ALT-B BACKWARD WORD + CTRL-RIGHT FORWARD WORD + CTRL-LEFT BACKWARD WORD CTRL-K KILL LINE FORWARDS CTRL-U KILL LINE BACKWARDS ALT-H KILL WORD BACKWARDS