-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: document readline keybindings #20825
Changes from 2 commits
13ecfa3
60165b7
c39f8b6
2faec19
e3d38dd
76d462c
67e3d92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,7 +287,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. | ||
|
||
|
@@ -527,6 +528,107 @@ rl.on('line', (line) => { | |
}); | ||
``` | ||
|
||
## TTY keybindings | ||
|
||
<table> | ||
<tr> | ||
<th>Keybindings</th> | ||
<th>Description</th> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+shift+backspace</code></td> | ||
<td>delete line left</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a must but I personally would prefer the descriptions all to start with a upper case character. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
</tr> | ||
<tr> | ||
<td><code>ctrl+shift+delete</code></td> | ||
<td>delete line right</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+c</code></td> | ||
<td>emits SIGINT</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
</tr> | ||
<tr> | ||
<td><code>ctrl+h</code></td> | ||
<td>delete left</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+d</code></td> | ||
<td>delete right or EOF</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+u</code></td> | ||
<td>delete from current to line start</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+k</code></td> | ||
<td>delete from current to end of line</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+a</code></td> | ||
<td>goto start of line</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
</tr> | ||
<tr> | ||
<td><code>ctrl+e</code></td> | ||
<td>goto to end of line</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
</tr> | ||
<tr> | ||
<td><code>ctrl+b</code></td> | ||
<td>back one character</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+f</code></td> | ||
<td>forward one character</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+l</code></td> | ||
<td>clear screen </td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+n</code></td> | ||
<td>next history item</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+p</code></td> | ||
<td>prev history item </td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
</tr> | ||
<tr> | ||
<td><code>ctrl+z</code></td> | ||
<td>(need clarification)</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey team. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not know, sorry( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BridgeAR I found this for If it's fine we can either ref to this or take the first paragraph and add here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please document it as e.g.: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
</tr> | ||
<tr> | ||
<td><code>ctrl+w</code> or <code>ctrl+backspace</code></td> | ||
<td>delete backwards to a word boundary</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+delete</code></td> | ||
<td>delete forward to a word boundary</td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+left</code></td> | ||
<td>word left </td> | ||
</tr> | ||
<tr> | ||
<td><code>ctrl+right</code></td> | ||
<td>word right</td> | ||
</tr> | ||
<tr> | ||
<td><code>meta+b</code></td> | ||
<td>word left</td> | ||
</tr> | ||
<tr> | ||
<td><code>meta+f</code></td> | ||
<td>word right</td> | ||
</tr> | ||
<tr> | ||
<td><code>meta+d</code> or <code>meta+delete</code></td> | ||
<td>delete word right</td> | ||
</tr> | ||
<tr> | ||
<td><code>meta+backspace</code></td> | ||
<td>delete word left </td> | ||
</tr> | ||
</table> | ||
|
||
[`'SIGCONT'`]: readline.html#readline_event_sigcont | ||
[`'SIGTSTP'`]: readline.html#readline_event_sigtstp | ||
[`process.stdin`]: process.html#process_process_stdin | ||
|
@@ -535,3 +637,4 @@ rl.on('line', (line) => { | |
[TTY]: tty.html | ||
[Writable]: stream.html#stream_writable_streams | ||
[reading files]: #readline_example_read_file_stream_line_by_line | ||
[`TTY keybindings`]: #readline_tty_keybindings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we do not need backticks in this case (this is not a code fragment). So this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need the same fix in the text) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,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 [`TTY keybindings`][]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
### Default Evaluation | ||
|
||
By default, all instances of `repl.REPLServer` use an evaluation function that | ||
|
@@ -634,3 +636,4 @@ For an example of running a REPL instance over [curl(1)][], see: | |
[`util.inspect()`]: util.html#util_util_inspect_object_options | ||
[curl(1)]: https://curl.haxx.se/docs/manpage.html | ||
[stream]: stream.html | ||
[`TTY keybindings`]: readline.html#readline_tty_keybindings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we do not need backticks in this case (this is not a code fragment). So this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,4 +161,4 @@ integer. | |
[`net.Socket`]: net.html#net_class_net_socket | ||
[`process.stdin`]: process.html#process_process_stdin | ||
[`process.stdout`]: process.html#process_process_stdout | ||
[`process.stderr`]: process.html#process_process_stderr | ||
[`process.stderr`]: process.html#process_process_stderr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing line break at the end of the file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: add whitespace between the individual commands and maybe also only highlight the keys, not the plus. As in:
<code>ctrl</code> + <code>shift</code> + <code>backspace</code>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason these are wrapped in
<code>
and not<kbd>
?