home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
text
/
textra
/
scripts
/
c_scripts
/
box.textra
next >
Wrap
Text File
|
1995-02-27
|
1KB
|
50 lines
/*
** routine to put a comment box around the selected text
** adapted from Mike Haas's 'slide' routine
*/
BOXWIDTH=72 /* Width of the comment box */
OPTIONS results
'get' "select position" /* get the select boundary, if any */
if (result == "NO SELECT") then /* is nothing selected? */
exit /* Then just go back */
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
'prefs' autoindent read; autoindent = result
'unselect'
'gotoxy' 0 starty
'textn' '/' || copies('*', BOXWIDTH-1)
do LinesSelected
/* At this point we are in column zero of a line to be
** included in the comment box. We go down a line and then left
** one char to get to the end of the line, and pad with spaces
** so that the '*' line up properly
*/
'text' '* '
'left' 2
'down' 1
'left' 1
'get' "cursor position"
parse var result curx .
'text' '"' || copies(' ', BOXWIDTH-curx-1) || '*"'
'right' 1
end
'textn' copies('*', BOXWIDTH-1) || '/'
'prefs' 'autoindent' autoindent
exit