home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: unwrap~removes new lines from the selected text. To
- use select one or more lines and then run the script.
- @See: wrap@Tools Reference/Tools/Misc.html#wrap
- @EndTool:
- @Summary: unwrap~removes new lines from the selected text
- */
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var selection = editor.getSelection();
- editor.select(selection.startLineIndex, 0);
-
- for (var lineIndex = selection.endLineIndex - 2;
- lineIndex >= selection.startLineIndex; lineIndex--)
- {
- var line = editor.copy(lineIndex+1);
- var index = 0;
- var value = line.charAt(index);
- while (index < line.length && (value == ' ' || value == '\t'))
- {
- index += 1;
- value = line.charAt(index);
- }
-
- editor.replace("", lineIndex, 32000, lineIndex+1, index);
- }
-
-
- editor.setActive("Unwrap Lines");
- }
- }
-
- !!/Script
-