1 2 3 4 5 6 7 8 9 10 11 12 | /* this XEDIT macro centres the line containing the cursor. */
width = 72 /* Width within which to centre the line */
"extract /cursor /curline" /* location of cursor and current line # */
if cursor.3=-1 /* if cursor is not on a line... */
then "emsg Cursor not in a data line" /* then give an error message */
else do
restore=curline.2-cursor.1 /* how far cursor is from current */
":"||cursor.3 /* make cursor line current */
"extract /curline" /* get the current line */
"replace" centre(strip(curline.3),width) /* centre the current line */
restore /* restore old current line */
end |