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
This commit is contained in:
Matt Pass
2013-09-19 20:24:43 +01:00
parent 5c347829a2
commit b3510dfb67

View File

@@ -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;
}
);