You can set bookmarks in Komodo, for ease ni revisiting certain lines. This recipe lets you delete all the marked lines in the current buffer. This code is undoable, but the markers are gone for good. They aren't restored by Scintilla, and having Komodo restore them would be a pain.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | var view = ko.views.manager.currentView;
var scimoz = view.scimoz;
view.scintilla.focus();
view.setFocus();
var currentPos = scimoz.currentPos;
var bmNum = ko.markers.MARKNUM_BOOKMARK;
var bmmask = 1 << bmNum;
var linesToDelete = [];
var nextLine = -1;
while (true) {
nextLine = scimoz.markerNext(nextLine + 1, bmmask);
if (nextLine == -1) {
break;
}
linesToDelete.push(nextLine);
}
scimoz.beginUndoAction();
try {
while (linesToDelete.length) {
var lineToDelete = linesToDelete.pop();
scimoz.markerDelete(lineToDelete, bmNum);
var startPos = scimoz.positionFromLine(lineToDelete);
var endPos = scimoz.positionFromLine(lineToDelete + 1);
var docLen = scimoz.length;
if (endPos > docLen) endPos = docLen;
scimoz.targetStart = startPos;
scimoz.targetEnd = endPos;
scimoz.replaceTarget(0, "");
}
} catch(ex) {
alert("Error removing lines: " + ex);
} finally {
scimoz.endUndoAction();
}
scimoz.currentPos = scimoz.anchor = currentPos;
|