home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: removeEmptyLines~removes all empty lines
- from the current selection. To use select multiple
- lines and then run the script.
- @See: wrap@Tools Reference/Tools/Misc.html#wrap
- @See: wrap@Tools Reference/Tools/Misc.html#unwrap
- @EndTool:
- @Summary: removeEmptyLines~removes empty lines
- */
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var selection = editor.getSelection();
- RemoveLines(editor, selection.startLineIndex, selection.endLineIndex);
- }
- editor.setActive("Remove Empty Lines");
- }
-
- function RemoveLines(editor, start, end)
- {
- var lineIndex = end
- while (lineIndex >= start)
- {
- var length = editor.getLineLength(lineIndex);
- if (length == 0)
- {
- editor.remove(lineIndex, 0, lineIndex + 1, 0);
- }
- lineIndex -= 1;
- }
- }
- !!/Script
-
-