Don't use ctrl+up/down hack on macOS

Fixes #2387
This commit is contained in:
Daniel Imms
2019-10-11 16:01:28 -07:00
parent e14b1f75fe
commit da11e31fe5
+6 -4
View File
@@ -122,7 +122,7 @@ export function evaluateKeyboardEvent(
// http://unix.stackexchange.com/a/108106 // http://unix.stackexchange.com/a/108106
// macOS uses different escape sequences than linux // macOS uses different escape sequences than linux
if (result.key === C0.ESC + '[1;3D') { if (result.key === C0.ESC + '[1;3D') {
result.key = isMac ? C0.ESC + 'b' : C0.ESC + '[1;5D'; result.key = C0.ESC + (isMac ? 'b' : '[1;5D');
} }
} else if (applicationCursorMode) { } else if (applicationCursorMode) {
result.key = C0.ESC + 'OD'; result.key = C0.ESC + 'OD';
@@ -141,7 +141,7 @@ export function evaluateKeyboardEvent(
// http://unix.stackexchange.com/a/108106 // http://unix.stackexchange.com/a/108106
// macOS uses different escape sequences than linux // macOS uses different escape sequences than linux
if (result.key === C0.ESC + '[1;3C') { if (result.key === C0.ESC + '[1;3C') {
result.key = isMac ? C0.ESC + 'f' : C0.ESC + '[1;5C'; result.key = C0.ESC + (isMac ? 'f' : '[1;5C');
} }
} else if (applicationCursorMode) { } else if (applicationCursorMode) {
result.key = C0.ESC + 'OC'; result.key = C0.ESC + 'OC';
@@ -158,7 +158,8 @@ export function evaluateKeyboardEvent(
result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A'; result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';
// HACK: Make Alt + up-arrow behave like Ctrl + up-arrow // HACK: Make Alt + up-arrow behave like Ctrl + up-arrow
// http://unix.stackexchange.com/a/108106 // http://unix.stackexchange.com/a/108106
if (result.key === C0.ESC + '[1;3A') { // macOS uses different escape sequences than linux
if (!isMac && result.key === C0.ESC + '[1;3A') {
result.key = C0.ESC + '[1;5A'; result.key = C0.ESC + '[1;5A';
} }
} else if (applicationCursorMode) { } else if (applicationCursorMode) {
@@ -176,7 +177,8 @@ export function evaluateKeyboardEvent(
result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B'; result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';
// HACK: Make Alt + down-arrow behave like Ctrl + down-arrow // HACK: Make Alt + down-arrow behave like Ctrl + down-arrow
// http://unix.stackexchange.com/a/108106 // http://unix.stackexchange.com/a/108106
if (result.key === C0.ESC + '[1;3B') { // macOS uses different escape sequences than linux
if (!isMac && result.key === C0.ESC + '[1;3B') {
result.key = C0.ESC + '[1;5B'; result.key = C0.ESC + '[1;5B';
} }
} else if (applicationCursorMode) { } else if (applicationCursorMode) {