From 96872eaa0012189df657c0284be7805cb3557610 Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Tue, 7 Jan 2020 07:37:42 -0500 Subject: [PATCH 1/5] doc: readline keybindings Added readline keybindings table to document --- doc/api/readline.md | 109 +++++++++++++++++++++++++++++++++++++++++++- doc/api/repl.md | 3 ++ 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/doc/api/readline.md b/doc/api/readline.md index cbb844886d6647..e7d29a85496730 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -293,7 +293,8 @@ added: v0.1.98 The `rl.write()` method will write either `data` or a key sequence identified by `key` to the `output`. The `key` argument is supported only if `output` is -a [TTY][] text terminal. +a [TTY][] text terminal. See [TTY keybindings][] for a list of key +combinations. If `key` is specified, `data` is ignored. @@ -722,6 +723,111 @@ const { createInterface } = require('readline'); })(); ``` +## TTY keybindings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeybindingsDescription
ctrl + shift + backspaceDelete line left
ctrl + shift + deleteDelete line right
ctrl + cEmit SIGINT
ctrl + hDelete left
ctrl + dDelete right or EOF
ctrl + uDelete from current to line start
ctrl + kDelete from current to end of line
ctrl + aGo to start of line
ctrl + eGo to to end of line
ctrl + bBack one character
ctrl + fForward one character
ctrl + lClear screen
ctrl + nNext history item
ctrl + pPrevious history item
ctrl + zMoves running process into background. Type + fg and press enter + to return.
ctrl + w or ctrl + + backspaceDelete backwards to a word boundary
ctrl + deleteDelete forward to a word boundary
ctrl + leftWord left
ctrl + rightWord right
meta + bWord left
meta + fWord right
meta + d or meta + + deleteDelete word right
meta + backspaceDelete word left
+ [`'SIGCONT'`]: readline.html#readline_event_sigcont [`'SIGTSTP'`]: readline.html#readline_event_sigtstp [`'line'`]: #readline_event_line @@ -731,5 +837,6 @@ const { createInterface } = require('readline'); [`rl.close()`]: #readline_rl_close [Readable]: stream.html#stream_readable_streams [TTY]: tty.html +[TTY keybindings]: #readline_tty_keybindings [Writable]: stream.html#stream_writable_streams [reading files]: #readline_example_read_file_stream_line_by_line diff --git a/doc/api/repl.md b/doc/api/repl.md index 602aea02ab5495..a0879fd50dd8b8 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -68,6 +68,8 @@ The following key combinations in the REPL have these special effects: variables. When pressed while entering other input, displays relevant autocompletion options. +For a full list of special keys, refer to [TTY keybindings][]. + ### Default Evaluation By default, all instances of [`repl.REPLServer`][] use an evaluation function @@ -736,5 +738,6 @@ For an example of running a REPL instance over [curl(1)][], see: [`repl.ReplServer`]: #repl_class_replserver [`repl.start()`]: #repl_repl_start_options [`util.inspect()`]: util.html#util_util_inspect_object_options +[TTY keybindings]: readline.html#readline_tty_keybindings [curl(1)]: https://curl.haxx.se/docs/manpage.html [stream]: stream.html From 0de07fca7db60e2200527cd258a81c3e5ee861c4 Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Wed, 8 Jan 2020 02:01:55 -0500 Subject: [PATCH 2/5] doc: document readline keybindings This is a rework of closed pr https://github.com/nodejs/node/pull/20825 fixes: https://github.com/nodejs/node/issues/20814 --- doc/api/readline.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/readline.md b/doc/api/readline.md index e7d29a85496730..3fb28bde564d39 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -828,6 +828,18 @@ const { createInterface } = require('readline'); +Below bindings doesn't work on all platforms +1. ctrl + shift + backspace: doesn't work on Linux, Mac and Windows +2. ctrl + shift + delete: doesn't work on Linux and Mac +3. ctrl + d: doesn't work on Windows +4. ctrl + z: doesn't work on Windows +5. ctrl + backspace: doesn't work as expected on Windows +6. ctrl + delete: doesn't work on Mac +7. ctrl + left: doesn't work on Mac +8. ctrl + right: doesn't work on Mac +9. meta + delete: deosn't work on windows +10. meta + backspace: doesn't work on Mac + [`'SIGCONT'`]: readline.html#readline_event_sigcont [`'SIGTSTP'`]: readline.html#readline_event_sigtstp [`'line'`]: #readline_event_line From 8d2ccef9bd265e93dfa1810b7b5d63be90a08118 Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Wed, 8 Jan 2020 12:56:33 -0500 Subject: [PATCH 3/5] fixup: address review comments --- doc/api/readline.md | 51 +++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/doc/api/readline.md b/doc/api/readline.md index 3fb28bde564d39..26cce5799807f8 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -729,18 +729,21 @@ const { createInterface } = require('readline'); Keybindings Description + Notes ctrl + shift + backspace Delete line left + Doesn't work on Linux, Mac and Windows ctrl + shift + delete Delete line right + Doesn't work on Linux and Mac ctrl + c - Emit SIGINT + Emit SIGINT or close the readline instance ctrl + h @@ -748,15 +751,16 @@ const { createInterface } = require('readline'); ctrl + d - Delete right or EOF + Delete right or close the readline instance in case the current line is empty / EOF + Doesn't work on Windows ctrl + u - Delete from current to line start + Delete from the current position to the line start ctrl + k - Delete from current to end of line + Delete from the current position to the end of line ctrl + a @@ -791,55 +795,48 @@ const { createInterface } = require('readline'); Moves running process into background. Type fg and press enter to return. + Doesn't work on Windows ctrl + w or ctrl + backspace Delete backwards to a word boundary + ctrl + backspace Doesn't + work as expected on Windows ctrl + delete Delete forward to a word boundary + Doesn't work on Mac - ctrl + left - Word left - - - ctrl + right - Word right - - - meta + b + ctrl + left or + meta + b Word left + ctrl + left Doesn't work + on Mac - meta + f + ctrl + right or + meta + f Word right + ctrl + right Doesn't work + on Mac meta + d or meta + delete Delete word right + meta + delete Doesn't work + on windows meta + backspace - Delete word left + Delete word left + Doesn't work on Mac -Below bindings doesn't work on all platforms -1. ctrl + shift + backspace: doesn't work on Linux, Mac and Windows -2. ctrl + shift + delete: doesn't work on Linux and Mac -3. ctrl + d: doesn't work on Windows -4. ctrl + z: doesn't work on Windows -5. ctrl + backspace: doesn't work as expected on Windows -6. ctrl + delete: doesn't work on Mac -7. ctrl + left: doesn't work on Mac -8. ctrl + right: doesn't work on Mac -9. meta + delete: deosn't work on windows -10. meta + backspace: doesn't work on Mac - [`'SIGCONT'`]: readline.html#readline_event_sigcont [`'SIGTSTP'`]: readline.html#readline_event_sigtstp [`'line'`]: #readline_event_line From b06aee5f8df9c4940e6814ea687490d5142b7712 Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Fri, 10 Jan 2020 00:55:08 -0500 Subject: [PATCH 4/5] fixup: address review comments --- doc/api/readline.md | 11 +++++++++++ doc/api/repl.md | 2 ++ 2 files changed, 13 insertions(+) diff --git a/doc/api/readline.md b/doc/api/readline.md index 26cce5799807f8..e54bfec7686337 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -744,10 +744,12 @@ const { createInterface } = require('readline'); ctrl + c Emit SIGINT or close the readline instance + ctrl + h Delete left + ctrl + d @@ -757,38 +759,47 @@ const { createInterface } = require('readline'); ctrl + u Delete from the current position to the line start + ctrl + k Delete from the current position to the end of line + ctrl + a Go to start of line + ctrl + e Go to to end of line + ctrl + b Back one character + ctrl + f Forward one character + ctrl + l Clear screen + ctrl + n Next history item + ctrl + p Previous history item + ctrl + z diff --git a/doc/api/repl.md b/doc/api/repl.md index a0879fd50dd8b8..2823157e6f2a64 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -68,6 +68,7 @@ The following key combinations in the REPL have these special effects: variables. When pressed while entering other input, displays relevant autocompletion options. +For key combinations to Reverse-i-search, refer to [`Reverse-i-search`][]. For a full list of special keys, refer to [TTY keybindings][]. ### Default Evaluation @@ -738,6 +739,7 @@ For an example of running a REPL instance over [curl(1)][], see: [`repl.ReplServer`]: #repl_class_replserver [`repl.start()`]: #repl_repl_start_options [`util.inspect()`]: util.html#util_util_inspect_object_options +[`Reverse-i-search`]: #repl_Reverse_i_search [TTY keybindings]: readline.html#readline_tty_keybindings [curl(1)]: https://curl.haxx.se/docs/manpage.html [stream]: stream.html From d0c4458dcdedc8003c2eee77ac1f4ead9fcdc102 Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Mon, 13 Jan 2020 00:26:46 -0500 Subject: [PATCH 5/5] fixup: address review comments --- doc/api/repl.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/repl.md b/doc/api/repl.md index 2823157e6f2a64..af7024379fbf0c 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -68,8 +68,8 @@ The following key combinations in the REPL have these special effects: variables. When pressed while entering other input, displays relevant autocompletion options. -For key combinations to Reverse-i-search, refer to [`Reverse-i-search`][]. -For a full list of special keys, refer to [TTY keybindings][]. +For key bindings related to the reverse-i-search, see [`reverse-i-search`][]. +For all other key bindings, see [TTY keybindings][]. ### Default Evaluation @@ -739,7 +739,7 @@ For an example of running a REPL instance over [curl(1)][], see: [`repl.ReplServer`]: #repl_class_replserver [`repl.start()`]: #repl_repl_start_options [`util.inspect()`]: util.html#util_util_inspect_object_options -[`Reverse-i-search`]: #repl_Reverse_i_search +[`reverse-i-search`]: #repl_reverse_i_search [TTY keybindings]: readline.html#readline_tty_keybindings [curl(1)]: https://curl.haxx.se/docs/manpage.html [stream]: stream.html