mirror of https://github.com/shadowfacts/type.git
Fix enter working in the middle of lines
This commit is contained in:
parent
b770fd1101
commit
9bc15fbbdf
2
main.js
2
main.js
|
@ -76,7 +76,7 @@ document.addEventListener("keydown", (event) => {
|
||||||
if (pos.line != editor.doc.size - 1) {
|
if (pos.line != editor.doc.size - 1) {
|
||||||
let currentLine = editor.doc.getLine(pos.line);
|
let currentLine = editor.doc.getLine(pos.line);
|
||||||
let trimmed = currentLine.trim();
|
let trimmed = currentLine.trim();
|
||||||
if (editor.getCursor().ch <= currentLine.indexOf(trimmed) + trimmed.length) {
|
if (editor.getCursor().ch >= currentLine.indexOf(trimmed) + trimmed.length) {
|
||||||
let newLine = pos.line + 1;
|
let newLine = pos.line + 1;
|
||||||
let text = editor.doc.getLine(newLine);
|
let text = editor.doc.getLine(newLine);
|
||||||
let ch = text.indexOf(text.trim());
|
let ch = text.indexOf(text.trim());
|
||||||
|
|
Loading…
Reference in New Issue