Columbo aufrufen.bsh zum Wurzelverzeichnis wechselnShell {Shell[73] PVS[91] CS[109]}Datei anzeigen
/**
* Transpose line at caret with previous line, and move caret to next line.
* Emulates Emacs "transpose-lines" command (without prefix argument support).
*/
source (MiscUtilities.constructPath(dirname(scriptPath), "EmacsUtil.bsh"));
void emacsTransposeLines()
{
caret = textArea.getCaretPosition();
if ((caret == 0) || atEndOfBuffer())
{
beep();
return;
}
caretLine = textArea.getCaretLine();
lineStart = textArea.getLineStartOffset (caretLine);
lineEnd = textArea.getLineEndOffset (caretLine);
lineIndex = textArea.getLineOfOffset (caretLine);
selection = new Selection.Range (lineStart, lineEnd);
line = textArea.getSelectedText(selection);
// Get the location of the previous line
textArea.goToPrevLine (false);
prevLineCaret = textArea.getCaretLine();
prevLineStart = textArea.getLineStartOffset (prevLineCaret);
// Go back to the original location.
textArea.setCaretPosition (caret);
// Delete the line
textArea.deleteLine();
// Insert it in the new location.
buffer.insert (prevLineStart, line);
}
emacsTransposeLines();
[ Original von:0.91Diese Quellcodebibliothek enthält Beispiele in vielen Programmiersprachen.
Man kann per Verzeichnistruktur darin navigieren.
Der Code wird farblich markiert angezeigt.
]