From de5459f07034d89b2e370a95d13ab2cb4446cefb Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 11 Feb 2010 10:09:36 +0100 Subject: Do not delete content after list on two enters --- lib/scripts/edit.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/scripts') 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]); } -- cgit v1.2.3