diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 483fcc3cc38e9d4fa47d465178c60925c90d4c21..235a91cd62534c68c089162582a62f4988e265ba 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]); }