mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-05 08:14:00 +01:00
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:
11
editor.php
11
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;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user