Terminal control/Preserve screen: Difference between revisions

From Rosetta Code
Content added Content deleted
(description updated in response to questions raised in discussion)
Line 1: Line 1:
{{draft task}}
{{draft task}}


The task is to clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out.
The task is to clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out. There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved. If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit.


[[Terminal Control::task| ]]
[[Terminal Control::task| ]]

Revision as of 19:43, 21 March 2011

Terminal control/Preserve screen is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out. There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved. If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit.


JavaScript

<lang javascript>(function() { var orig= document.body.innerHTML document.body.innerHTML= ; setTimeout(function() { document.body.innerHTML= 'something'; setTimeout(function() { document.body.innerHTML= orig; }, 1000); }, 1000); })(); </lang>

This implementation assumes that Javascript is running in the browser.

This task does not admit sample output, but you can demonstrate this solution for yourself using the chrome browser: control-shift-J then copy and paste the above into the command line, and hit enter.