Jump to content

Terminal control/Preserve screen: Difference between revisions

→‎{{header|REXX}}: elided the use of the second CLS command, added/changed comments and indentations, changed the wording in the REXX section header.
mNo edit summary
(→‎{{header|REXX}}: elided the use of the second CLS command, added/changed comments and indentations, changed the wording in the REXX section header.)
Line 219:
 
=={{header|REXX}}==
This version <u>only</u> works with PC/REXX and Personal REXX.
 
<lang rexx>/*REXX pgm saves the screen contents, clear it, write +++, restore orig.*/
The &nbsp; '''CLS''' &nbsp; (DOS) command is used to clear the terminal screen.
parse value scrsize() with sd sw . /*determine how big the screen is*/
<lang rexx>/*REXX pgmprogram saves the screen contents, clearand it,also writethe +++cursor location, restore orig.then clears the */
parse value cursor(1,1) with r_ c_ /*find where the cursor is also. */
/*──── screen, writes a half screen of ~~~ lines, and then do original=1 for sd /*getrestores the original screen content.*/
 
@line.original=scrread(original,1,sw)
parse value scrsize() with sd sw . /*determine howthe bigsize theof screenterminal isscreen*/
end
parse value cursor(1,1) with r_ c_curRow curCol . /*also, find where the cursorlocation isof also.the cursor*/
'CLS' /*start with a clean slate. */
 
do 20
do original=1 for sd say copies('$',60) /*writeobtain athe scoreoriginal ofscreen sixty buckscontents. */
@line.original=scrreadscrRead(original,1, sw) /*obtain a line of the terminal screen.*/
end
'CLS' end /*original*/ /*start with[↑] obtains SD number aof cleanlines. slate, again*/
'CLS' do restore=1 for sd /*restorestart thewith originala screen.clean slate on terminal.*/
do sd % 2 /*write a line of ~~~ for half of scr. */
call scrwrite restore,1,strip(@line.restore,'T')
say '~~~' /*writes ~~~ starting at top of screen.*/
end
call cursor r_,c_ end /*sd % 2*/ /*restore the[↑] this shows ~~~ originalwill cursorbe posoverlaid*/
/*stickno aneed forkto inclear it,the we'rescreen donehere. */</lang>
do restore=1 for sd /*restore original screen from @line. */
This REXX program makes use of &nbsp; '''SCRSIZE''' &nbsp; REXX program (or BIF) which is used to determine the screen size of the terminal (console).
call scrWrite restore,1, @line.restore /*write to terminal the original lines.*/
<br>The &nbsp; '''SCRSIZE.REX''' &nbsp; REXX program is included here ──► [[SCRSIZE.REX]].<br>
end /*restore*/ /* [↑] writes (restores) SD lines. */
'CLS' /*start withstick a cleanfork slate.in it, we're all done. */
call cursor curRow, curCol /*restore the original cursor position.*/</lang>
This REXX program makes use of &nbsp; '''SCRSIZEscrsize''' &nbsp; REXX program (or BIF) which is used to determine the screen size of the terminal (console).
 
<br>TheFor those REXXes that don't have the &nbsp; '''scrsize''' &nbsp; BIF, the &nbsp; '''SCRSIZE.REX''' &nbsp; REXX program is included here &nbsp; ──► &nbsp; [[SCRSIZE.REX]]. <br><br>
 
=={{header|Scala}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.