title: Rewind past a block of text in VT100 terminal commands
body: <p>I basically want to manipulate the output of some program connected to a terminal so that the bottom section of text is always some arbitrary block of text (let's call it the footer), while the normal output of the program is displayed above that. If this footer was confined to a single terminal line, this would be very easy to do by simply clearing the current line, moving the cursor to the beginning of the line before each <code>write</code> call, and then rewriting the footer. However, if my desired footer spans multiple terminal lines, either by including newline characters or by lines wrapping around the edge of the screen, things are complicated. I thought I might be able to work around that with the "save cursor" and "restore cursor" VT100 control codes, which would be emitted as such for every write:</p>
  
  <ol>
  <li>restore cursor</li>
  <li>desired <code>write</code> call</li>
  <li>save cursor</li>
  <li>output footer</li>
  </ol>
  
  <p>However these don't work when the output text reaches the bottom of the terminal because the saved cursor will always be at the bottom row.</p>
  
  <p>Is there any way achieve this arbitrary terminal footer? Something with just VT100 codes would be ideal, but if the only way is to use curses then I suppose that's possible, too.</p>