Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 55da2ac

Browse files
committed
Add a comment about alt key.
1 parent bc94eac commit 55da2ac

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/shell/Job.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,20 @@ export class Job extends EmitterWithUniqueID implements TerminalLikeDevice {
125125
text = input;
126126
} else {
127127
if (input.ctrlKey) {
128+
/**
129+
* @link https://unix.stackexchange.com/a/158298/201739
130+
*/
128131
text = String.fromCharCode(input.keyCode - 64);
129132
} else if (input.altKey) {
133+
/**
134+
* The alt key can mean two things:
135+
* - send an escape character before special keys such as cursor-keys, or
136+
* - act as an extended shift, allowing you to enter codes for Latin-1 values from 160 to 255.
137+
*
138+
* We currently don't support the second one since it's less frequently used.
139+
* For future reference, the correct extended code would be keyCode + 160.
140+
* @link http://invisible-island.net/ncurses/ncurses.faq.html#bash_meta_mode
141+
*/
130142
let char = String.fromCharCode(input.keyCode);
131143
if (input.shiftKey) {
132144
char = char.toUpperCase();

0 commit comments

Comments
 (0)