mirror of https://github.com/shadowfacts/type.git
Fix being able to skip the last line
This commit is contained in:
parent
019e985587
commit
a15d47d4e5
12
js/main.js
12
js/main.js
|
@ -159,10 +159,10 @@ function handleDelete(event) {
|
||||||
|
|
||||||
function handleEnter(event) {
|
function handleEnter(event) {
|
||||||
let pos = editor.getCursor();
|
let pos = editor.getCursor();
|
||||||
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) {
|
if (pos.line < editor.doc.size - 1) {
|
||||||
var newLine = pos.line;
|
var newLine = pos.line;
|
||||||
while (true) {
|
while (true) {
|
||||||
newLine++;
|
newLine++;
|
||||||
|
@ -181,9 +181,9 @@ function handleEnter(event) {
|
||||||
}
|
}
|
||||||
updateIncompleteMark();
|
updateIncompleteMark();
|
||||||
save();
|
save();
|
||||||
|
} else {
|
||||||
|
goToNextChunk();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
goToNextChunk();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue