home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
DOS
/
TEKST
/
AURORA2
/
DELBLANK.AML
< prev
next >
Wrap
Text File
|
1995-04-28
|
2KB
|
60 lines
/* ------------------------------------------------------------------ */
/* Macro: DELBLANK.AML */
/* Written by: nuText Systems */
/* */
/* Description: This macro deletes blank lines in the current edit */
/* window. The operation is confined to a marked block */
/* if one exists. */
/* */
/* Usage: Select this macro from the Macro List (on the Macro */
/* menu), or run it from the macro picklist <shift f12> */
/* This macro will run faster if Undo is turned OFF. */
/* ------------------------------------------------------------------ */
include bootpath "define.aml"
var count
// test for edit windows
if not wintype? "edit" then
msgbox "Edit windows only!"
return
end
// test if a marked block exists in the current file
block_count = mark? and getmarkbuf == getcurrbuf
// display message
say "Deleting blank lines" + (if? block_count " in block") + "..."
// set search options
options = "x*" + (if? block_count 'b')
// save cursor position and goto first line
pushcursor
gotopos 1 (if? block_count (getmarktop) 1)
// mark the beginning of an undoable group of operations
undobegin
// search for blank lines using regular expressions
while find "^ *$" options do
delline
count = count + 1
end
// mark the end of an undoable group of operations
undoend
// restore cursor
popcursor
// clear the title bar
display
// display the word count
shortbox (if? count (thousands count) "No") + " lines deleted" +
(if? block_count " in the block")