-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
Context: #264 (comment)
Finding the commit they were added to confirm is also a good idea.
xterm.js/src/common/input/Keyboard.ts
Lines 114 to 189 in 8b42244
case 37: | |
// left-arrow | |
if (ev.metaKey) { | |
break; | |
} | |
if (modifiers) { | |
result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D'; | |
// HACK: Make Alt + left-arrow behave like Ctrl + left-arrow: move one word backwards | |
// http://unix.stackexchange.com/a/108106 | |
// macOS uses different escape sequences than linux | |
if (result.key === C0.ESC + '[1;3D') { | |
result.key = C0.ESC + (isMac ? 'b' : '[1;5D'); | |
} | |
} else if (applicationCursorMode) { | |
result.key = C0.ESC + 'OD'; | |
} else { | |
result.key = C0.ESC + '[D'; | |
} | |
break; | |
case 39: | |
// right-arrow | |
if (ev.metaKey) { | |
break; | |
} | |
if (modifiers) { | |
result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C'; | |
// HACK: Make Alt + right-arrow behave like Ctrl + right-arrow: move one word forward | |
// http://unix.stackexchange.com/a/108106 | |
// macOS uses different escape sequences than linux | |
if (result.key === C0.ESC + '[1;3C') { | |
result.key = C0.ESC + (isMac ? 'f' : '[1;5C'); | |
} | |
} else if (applicationCursorMode) { | |
result.key = C0.ESC + 'OC'; | |
} else { | |
result.key = C0.ESC + '[C'; | |
} | |
break; | |
case 38: | |
// up-arrow | |
if (ev.metaKey) { | |
break; | |
} | |
if (modifiers) { | |
result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A'; | |
// HACK: Make Alt + up-arrow behave like Ctrl + up-arrow | |
// http://unix.stackexchange.com/a/108106 | |
// macOS uses different escape sequences than linux | |
if (!isMac && result.key === C0.ESC + '[1;3A') { | |
result.key = C0.ESC + '[1;5A'; | |
} | |
} else if (applicationCursorMode) { | |
result.key = C0.ESC + 'OA'; | |
} else { | |
result.key = C0.ESC + '[A'; | |
} | |
break; | |
case 40: | |
// down-arrow | |
if (ev.metaKey) { | |
break; | |
} | |
if (modifiers) { | |
result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B'; | |
// HACK: Make Alt + down-arrow behave like Ctrl + down-arrow | |
// http://unix.stackexchange.com/a/108106 | |
// macOS uses different escape sequences than linux | |
if (!isMac && result.key === C0.ESC + '[1;3B') { | |
result.key = C0.ESC + '[1;5B'; | |
} | |
} else if (applicationCursorMode) { | |
result.key = C0.ESC + 'OB'; | |
} else { | |
result.key = C0.ESC + '[B'; | |
} | |
break; |
Activity