home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
util
/
polyed-1.242.lha
/
PolyEd
/
Macros
/
center.ped
next >
Wrap
Text File
|
1994-09-22
|
1KB
|
45 lines
/*
** $VER: center.ped 1.0 (17.09.1994) written by Robert Brandner
**
** This macro centers text in current line, according to the
** linelength specified in the settings.
*/
OPTIONS RESULTS
/*
** first we get the cursor position, the current line,
** and the current right border limit.
*/
'GETCURSORPOS STEM CPOS.' /* position in CPOS.LINE and CPOS.COLUMN */
'GETLINE VAR LINE'
'GETATTR APPLICATION FIELD VAR_RIGHTBORDER VAR WIDTH'
/*
** Now we remove leading and trailing spaces and
** center the remaining text to the demanded width
** (which is quite easy thanks to Rexx)
*/
STRIPPED = strip(LINE, 'B') /* remove trailing and leading spaces */
CENTRED = center(STRIPPED, WIDTH) /* center line */
NEW = strip(CENTRED, 'T') /* remove trailing spaces */
/*
** We clear the current line and insert the centered instead
*/
'POSITION SOL' /* mark completeline */
'BLOCK START'
'POSITION EOL'
'ERASE' /* erase marked block */
'TEXT' TEXT NEW /* insert centered line */
/*
** At last we reset the cursor to the original position
*/
'GOTOCOLUMN' CPOS.COLUMN /* reset cursor */