diff options
-rw-r--r-- | lib/scripts/edit.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 483fcc3cc..235a91cd6 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -169,7 +169,11 @@ function keyHandler(e){ var match2 = search.match(/^\n +[\*-]\s*$/); // Cancel list if the last item is empty (i. e. two times enter) if (match2 && field.value.substr(selection.start).match(/^($|\n)/)) { - field.value = field.value.substr(0, linestart) + "\n"; + field.value = field.value.substr(0, linestart) + "\n" + + field.value.substr(selection.start); + selection.start = linestart + 1; + selection.end = linestart + 1; + setSelection(selection); } else { insertAtCarret(field.id,match[1]); } |