Browse Source

Handle tab press

master
Shadowfacts 5 years ago
parent
commit
3d780753c4
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
  1. 11
      js/type.js

11
js/type.js

@ -165,6 +165,9 @@ function handleKeyDown(event) {
} else if (event.keyCode == 13) { // enter
event.preventDefault();
handleEnter(event);
} else if (event.keyCode == 9) { // tab
event.preventDefault();
handleTab(event);
}
}
}
@ -225,6 +228,14 @@ function handleEnter(event) {
}
}
function handleTab(event) {
let pos = editor.getCursor();
let line = editor.doc.getLine(pos.line);
if (line.charCodeAt(pos.ch) == 9) {
setCursor({ line: pos.line, ch: pos.ch + 1 });
}
}
function moveToEndOfPreviousLine() {
let pos = editor.getCursor();
if (pos.line > 0) {

Loading…
Cancel
Save