home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
amac41.arj
/
DELSP11.QM
< prev
next >
Wrap
Text File
|
1991-07-29
|
11KB
|
263 lines
* DELSP11.QM
* Macros To Delete Leading Spaces From Lines
* Written by John Goodman
* July 28, 1991
* ================================================================
*
* The following macros may be used to delete leading spaces from
* various lines in the file currently being edited. The following
* macros are provided:
* -Bytes-
* @(1) Delete Leading Spaces from Current Line (11) |chg
* @(2) Delete Leading Spaces from Lines Delineated by Any (22)
* Block (or Current Line if No Blocks Marked)
* @(3) Delete Leading Spaces from Current Paragraph (15)
* @(4) Delete Leading Spaces from Current Paragraph and (18)
* Reformat Paragraph to Right Margin
* @(5) Reformat Current Paragraph Ignoring AutoIndent Mode (20)
* @(6) Delete Leading Spaces from All Lines in File (13)
* @(7) Delete Leading Spaces from All Lines in File and (19)
* Reformat All Paragraphs to Right Margin
*
* (@2 is probably the most versatile of the set)
*
* (Version) History
*
*-- eoi
* Each of the macros should operate correctly regardless of QConfig
* or QEdit mode settings (Insert mode, WordWrap mode, etc.). Most
* of the macros work by creating a column block that is 2
* characters wide at the beginning of each line from which leading
* spaces are to be deleted. When the "CenterLine" command is
* executed, with the cursor in the 2-column block, QEdit tries to
* center the line within the 2 columns. This results in all
* leading spaces being deleted from the line(s).
*
* Another excellent technique for deleting leading characters from
* non-blank lines (i.e., test for a non-blank line first) is as
* follows:
*
* BegLine * Go to 1st character of line
* ShiftRight * Create at least 1 space at beginning of line
* DelRtWord * DelRtWord deletes all space characters up
* * to the first non-blank character
* * (including "non-word" characters)
*
* Be aware that if lines other than the current line are blocked,
* the ShiftRight command will shift all of them. (Thanks to Tim
* Farley of SemWare for the ideas behind this technique.)
*
* ---------------------------------------------
* @(1) Delete Leading Spaces from Current Line
* ---------------------------------------------
* This macro deletes all space characters from the beginning of the
* current line. The cursor is positioned on the following line
* after macro execution so that the macro can be invoked repeatedly
* to delete the leading spaces from a series of lines.
*
@1 MacroBegin
BegLine * Go to beginning of line
SplitLine * Split line at beginning
CursorRight * Move to col 2
JoinLine * Re-join the line
CursorLeft * Move back to col 1
DelRtWord * Delete leading spaces
CursorDown * Move to next line to do again
*
* 12 bytes Tue 06-25-1991 15:13:57 (JG)
* 11 bytes Sun 07-28-1991 17:21:41 (JG)
*
* ----------------------------------------------------------------
* @(2) Delete Leading Spaces from Line(s) Delineated by any Block
* (or Current Line if no Blocks Marked)
* ----------------------------------------------------------------
* This macro will delete the space characters from the beginning of
* each line that is bound by a block begin and end point. Any type
* of block (character, line, or column) may be used to delineate
* the line(s) and only one block marker need be set. If no block
* markers are set, the current line is acted upon. The cursor will
* be placed on the line following the last one acted upon so that
* the macro can be invoked repeatedly to delete the leading spaces
* from a series of lines.
*
@2 MacroBegin
CursorRight * Needed for single line block
GotoBlockEnd * Try going to block end, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockEnd * Go to block end to retain position
MarkLine * Mark first line
BLK: * Line block now set
BegLine * Go to begin of last line
GotoBlockBeg * Go straight up to 1st line of block
MarkColumn * Start column block
PrevPosition * Return to last line of block
BegLine * Make sure we're in col 1
CursorRight * Move to column 2 (block now 2 cols)
CenterLine * Centerline will now del leading spaces
UnmarkBlock * Unmark the block
BegLine * Go to begin of last line
CursorDown * Move to next line to do again!
*
* 22 bytes Tue 06-25-1991 12:52:01 (JG)
* (THH added from QEdit docs, June 25, 1991)...
* [CenterLine] <^CL>
* ────────────────────────────────────────────────────────────────────
* If the cursor is inside a column block, the lines encompassed by the
* block are centered using the left and right columns of the block as
* the margins.
*
* If the cursor is inside a line block, the lines encompassed by the
* block are centered using column 1 and the right margin as the margins.
*
* Otherwise, the line the cursor is on is centered, using column 1 and
* the right margin as the margins.
*
* --------------------------------------------------
* @(3) Delete Leading Spaces from Current Paragraph
* --------------------------------------------------
* This macro deletes all space characters from the beginning of the
* lines in the paragraph in which the cursor is currently
* positioned. If the cursor is on a blank line (not in a
* paragraph), then the previous paragraph will be acted upon. The
* cursor will be positioned at the beginning of the next paragraph
* after macro execution so that the macro can be invoked repeatedly
* to format a series of paragraphs.
*
@3 MacroBegin
UnmarkBlock * Ensure no blocks marked
CursorDown * Move down one line
PrevPara * Go to begin of curr para
BegLine * Start in col 1
MarkColumn * Start Column block
EndPara * Go to last line of para
BegLine * Go to line begin
CursorRight * Create 2 column block
CenterLine * Centerline dels leading spaces
UnmarkBlock * Unmark the block
NextPara * Move to next para to do again!
*
* 15 bytes Tue 06-25-1991 16:28:15 (JG)
*
* ------------------------------------------------------
* @(4) Delete Leading Spaces from Current Paragraph and
* Reformat Paragraph to Right Margin
* ------------------------------------------------------
* This macro deletes all space characters from the beginning of the
* lines in the paragraph in which the cursor is currently
* positioned and reformats (wordwraps) the paragraph at the
* currently defined right margin. If the cursor is on a blank line
* (not in a paragraph), then the previous paragraph will be acted
* upon. The cursor will be positioned at the beginning of the next
* paragraph after macro execution so that the macro can be invoked
* repeatedly to format a series of paragraphs.
*
@4 MacroBegin
UnmarkBlock * Ensure no blocks marked
CursorDown * Move down one line
PrevPara * Go to begin of curr para
BegLine * Start in col 1
MarkColumn * Start Column block
EndPara * Go to last line of para
BegLine * Go to line begin
CursorRight * Create 2 column block
CenterLine * Centerline dels leading spaces
UnmarkBlock * Unmark the block
CursorDown
PrevPara
WrapPara
NextPara * Move to next para to do again!
*
* 18 bytes Tue 06-25-1991 16:36:50 (JG)
*
* ---------------------------------------------------------
* @(5) Reformat Current Paragraph Ignoring AutoIndent Mode
* ---------------------------------------------------------
* The following macro will reformat (wordwrap) the paragraph in
* which the cursor is currently placed (or the previous paragraph
* if the cursor is on a blank line) and will ignore AutoIndent mode
* if it is set to ON. The 1st line of the paragraph will retain
* its indentation; the 2nd and subsequent lines will be left
* justified to column 1 (as if AutoIndent were OFF).
*
@5 MacroBegin
UnmarkBlock * Ensure no blocks marked
CursorDown PrevPara * Move to 1st line of current para
WrapPara PrevPara * Wrap the para and return to 1st line
CursorDown * Move to 2nd line of para
EndLine BegLine * Test if there is a 2nd line
JFalse END: * Skip if no 2nd line
ShiftRight * Create space at front of line
DelRtWord * Remove leading spaces
CursorUp * Move back to 1st line of para
WrapPara * Re-wrap the para
END:
NextPara * Move to next para to do again!
*
* 20 bytes Tue 06-25-1991 15:43:06 (JG)
*
* --------------------------------------------------
* @(6) Delete Leading Spaces from All Lines in File
* --------------------------------------------------
* This macro deletes all space characters from the beginning of
* each line in the file currently being edited.
*
@6 MacroBegin
UnmarkBlock * Ensure no blocks marked
EndFile * Go to last line of file
BegLine * Move to column 1
MarkColumn * Start Column Block
BegFile * Go to begin of file
CursorRight * Create 2 column block
CenterLine * Centerline will del leading spaces
UnmarkBlock * Unmark the block
BegLine * Return to file begin
*
* 13 bytes Tue 06-25-1991 15:04:05 (JG)
*
* ---------------------------------------------------------------
* @(7) Delete Leading Spaces from All Lines in File and Reformat
* All Paragraphs to Right Margin
* ---------------------------------------------------------------
* This macro deletes all space characters from the beginning of
* each line in the file currently being edited and reformats
* (wordwraps) all paragraphs to the currently defined right margin
* setting.
*
@7 MacroBegin
UnmarkBlock * Ensure no blocks marked
EndFile * Go to last line of file
BegLine * Move to column 1
MarkColumn * Start Column Block
BegFile * Go to begin of file
CursorRight * Create 2 column block
CenterLine * Centerline will del leading spaces
UnmarkBlock * Unmark the block
BegLine * Return to file begin
WRAPLOOP: * Loop for each para in file
WrapPara * Wrap the para
CursorDown * Try moving down 1 line
JTrue WRAPLOOP: * Can't move down if at EOF
BegFile * Return to begin of file
*
* 19 bytes Tue 06-25-1991 15:03:29 (JG)
* (Version) History
* -----------------
* July 28, 1991 1.1 - Minor documentation change by TH.
* - Shortened @1 one byte.
*
*
*