home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1999 - Modelworks Software
- // @Created build 305 cm1999622
-
- /**
- @Tool: reverseLines~reverses lines in
- the current selection.
- @EndTool:
- @Summary: reverseLines~reverses lines
- */
-
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var range = editor.getSelection();
-
- editor.select(range.startLineIndex, 0, range.startLineIndex, 0);
-
- if (range.endCharIndex == 0)
- {
- range.endLineIndex -= 1;
- }
- var i = range.startLineIndex;
- var j = range.endLineIndex;
- if ( i < j)
- {
- for (; i < j; i++, j--)
- {
- var iline = editor.copy(i);
- var jline = editor.copy(j);
-
- editor.replace(iline, j);
- editor.replace(jline, i);
- }
-
- editor.select(range.startLineIndex, 0, range.endLineIndex+1, 0);
- editor.setActive("Reverse Lines"); // So you can undo the reverse
- }
- }
- }
-
- !!/Script
-
-