From a15d47d4e58b5ac19cbe1531c1ad5b31e07ecece Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 1 Oct 2016 17:51:22 -0400 Subject: [PATCH] Fix being able to skip the last line --- js/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index 47684e9..73f7c57 100644 --- a/js/main.js +++ b/js/main.js @@ -159,10 +159,10 @@ function handleDelete(event) { function handleEnter(event) { let pos = editor.getCursor(); - if (pos.line < editor.doc.size - 1) { - let currentLine = editor.doc.getLine(pos.line); - let trimmed = currentLine.trim(); - if (editor.getCursor().ch >= currentLine.indexOf(trimmed) + trimmed.length) { + let currentLine = editor.doc.getLine(pos.line); + let trimmed = currentLine.trim(); + if (editor.getCursor().ch >= currentLine.indexOf(trimmed) + trimmed.length) { + if (pos.line < editor.doc.size - 1) { var newLine = pos.line; while (true) { newLine++; @@ -181,9 +181,9 @@ function handleEnter(event) { } updateIncompleteMark(); save(); + } else { + goToNextChunk(); } - } else { - goToNextChunk(); } }