home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
626a.lha
/
Textra_v1.12
/
Scripts
/
DoubleSpace.textra
< prev
next >
Wrap
Text File
|
1991-12-18
|
2KB
|
116 lines
/*******************************************************************
* TEXTRA AREXX script -- Mike Haas, 1991, All Rights Reserved. *
* Freely distributable ONLY as a component of the TEXTRA package. *
* This banner may not be removed or altered (improvements to the *
* actual program welcome). Please document and send to me. *
*******************************************************************/
/* Usage: DoubleSpace
*
* This script inserts a blank line between each text-bearing line
* in the select range. No parameters are required.
*
*/
OPTIONS results
/* temporarily make sure auto indent is off */
prefs autoindent read; autoistate = result
prefs autoindent off
get select position /* get the select boundary, if any */
if (result == "NO SELECT") then /* is nothing selected? */
do
get cursor position /* nothing selected, get cursor pos */
parse var result cursx ' ' cursy
LinesSelected = 0 /* means 'just cursor' */
end
else
do
/* yes, there is a selection, get it's boundaries */
parse var result startx ' ' starty ' ' endx ' ' endy
LinesSelected = (endy - starty)
/* if only the 'eol' of the previous line is selected
(nothing on this line is actually included, i.e. x==0),
then don't include it.
*/
if (endx > 0) then LinesSelected = LinesSelected + 1
end
if (LinesSelected == 0) then
do
gotoxy 0 cursy+1
newline
up 1
end
else
do
currline = starty; numLeft = LinesSelected
do while (numLeft > 0)
do
call CheckDoCurrLine
if (DoCurrLine == 1) then
do
gotoxy 0 currline + 1
left 1
newline
currline = currline + 2
end
else
currline = currline + 1
numLeft = numLeft - 1
end
end
/* gotoxy 0 starty
selectto 0 starty+LinesSelected */
gotoxy 0 currline
end
/* restore autoindent */
prefs autoindent autoistate
exit
CheckDoCurrLine:
DoCurrLine = 0
ThisLine = currline + 1
call CheckThisLine
lineplusone = DoCurrLine
DoCurrLine = 0
ThisLine = currline
call CheckThisLine
DoCurrLine = BITAND(lineplusone,DoCurrLine)
return
CheckThisLine:
gotoxy 0 ThisLine
get cursor char
do while (result ~= -1)
do
if ((result ~= ' ') & (result ~= ' ')) /*TAB*/ then
do
DoCurrLine = 1
leave
end
right 1
get cursor char
end
end
return