From b3510dfb6763a5d984e09d3c1b25d076e7b4774e Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 19 Sep 2013 20:24:43 +0100 Subject: [PATCH] Remove empty lines on cursor move beforeSelectChange stores the previous line number On cursor activity now it works out if the line we were on would be empty if we removed white space and if so, clear the line --- editor.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/editor.php b/editor.php index acff470..99e07e6 100644 --- a/editor.php +++ b/editor.php @@ -199,6 +199,17 @@ function createNewCMInstance(num) { if (top.ICEcoder.caretLocType=="CSS") { top.ICEcoder.cssColorPreview(); } + if (top.ICEcoder.prevLine != window['cM'+num].getCursor().line && + window['cM'+num].getLine(top.ICEcoder.prevLine) && + window['cM'+num].getLine(top.ICEcoder.prevLine).length > 0 && + window['cM'+num].getLine(top.ICEcoder.prevLine).replace(/\s/g, '').length == 0) { + window['cM'+num].setLine(top.ICEcoder.prevLine,""); + } + } + ); + + window['cM'+num].on("beforeSelectionChange", function(thisCM, changeObj) { + top.ICEcoder.prevLine = window['cM'+num].getCursor().line; } );