From 912f69c725744c9157110cc335f179cc2fc4aa4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 10 Sep 2017 15:32:58 +0200 Subject: [PATCH] added editing commands --- .eslintrc | 4 ++-- jssrc/term_input.js | 32 ++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.eslintrc b/.eslintrc index eecb50b..63163e3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -97,7 +97,7 @@ "allowSamePrecedence": true }], "no-mixed-spaces-and-tabs": "error", - "no-multi-spaces": "error", + "no-multi-spaces": "off", "no-multi-str": "error", "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }], "no-negated-in-lhs": "error", @@ -125,7 +125,7 @@ "no-template-curly-in-string": "error", "no-this-before-super": "error", "no-throw-literal": "error", - "no-trailing-spaces": "error", + "no-trailing-spaces": "off", "no-undef": "off", "no-undef-init": "error", "no-unexpected-multiline": "error", diff --git a/jssrc/term_input.js b/jssrc/term_input.js index 31141ce..0411b7e 100644 --- a/jssrc/term_input.js +++ b/jssrc/term_input.js @@ -153,11 +153,35 @@ window.Input = (function () { for (let i = 1; i <= 26; i++) { bind('ctrl+' + String.fromCharCode(96 + i), String.fromCharCode(i)) } - bind('ctrl+]', '\x1b') // alternate way to enter ESC + bind('ctrl+]', '\x1b') // alternate way to enter ESC bind('ctrl+\\', '\x1c') - bind('ctrl+[', '\x1d') - bind('ctrl+^', '\x1e') - bind('ctrl+_', '\x1f') + bind('ctrl+[', '\x1d') + bind('ctrl+^', '\x1e') + bind('ctrl+_', '\x1f') + + // extra ctrl- + bind('ctrl+left', '\x1f[1;5D') + bind('ctrl+right', '\x1f[1;5C') + bind('ctrl+up', '\x1f[1;5A') + bind('ctrl+down', '\x1f[1;5B') + bind('ctrl+home', '\x1f[1;5H') + bind('ctrl+end', '\x1f[1;5F') + + // extra shift- + bind('shift+left', '\x1f[1;2D') + bind('shift+right', '\x1f[1;2C') + bind('shift+up', '\x1f[1;2A') + bind('shift+down', '\x1f[1;2B') + bind('shift+home', '\x1f[1;2H') + bind('shift+end', '\x1f[1;2F') + + // macOS editing commands + bind('⌥+left', '\x1fb') // ⌥← to go back a word (^[b) + bind('⌥+right', '\x1ff') // ⌥→ to go forward one word (^[f) + bind('⌘+left', '\x01') // ⌘← to go to the beginning of a line (^A) + bind('⌘+right', '\x05') // ⌘→ to go to the end of a line (^E) + bind('⌥+backspace', '\x17') // ⌥⌫ to delete a word (^W, I think) + bind('⌘+backspace', '\x15') // ⌘⌫ to delete to the beginning of a line (possibly ^U) _bindFnKeys() }