Terminal Modifiers¶
Terminals are not just static blocks of text - almost all terminals support the use of ANSI escape codes. The problem of course is that these escape codes are both ancient and arcane, and hence difficult to use.
The functions here simply print one or more ANSI escape codes to the standard output. Note that whilst this will result in expected behaviour on almost all terminals designed after 1975, it will result in horrible gobbledegook if piped to a file. I might try to rectify this via isatty(), but that might not work particularly well.
-
inline void
JSL::jumpLineUp()¶ Deletes the last linebreak character, jumping the cursor up one line.
-
inline void
JSL::clearScreen()¶ Equivalent to calling the “clear” command on the shell, removes all text on the terminal, and returns the cursor to the home position.
-
inline void
JSL::deleteLine()¶ Removes the last line of text, moving the cursor from its current position, to the beginning of the line. If you want to remove the linebreak which caused that line to exist in the first place, must be followed up with jumpLineUp(). ALternatively, if a linebreak has been printed and you want to delete that line first, you must call jumpLineUp() before deleteLine().