unscroll.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. .. _unscroll:
  2. Unscrolling the screen
  3. ========================
  4. This is a small extension to the `SD (Pan up) escape code
  5. <https://vt100.net/docs/vt510-rm/SD.html>`_ from the VT-420 terminal. The ``SD``
  6. escape code normally causes the text on screen to scroll down by the specified
  7. number of lines, with empty lines appearing at the top of the screen. This
  8. extension allows the new lines to be filled in from the scrollback buffer
  9. instead of being blank.
  10. The motivation for this is that many modern shells will show completions in a
  11. block of lines under the cursor, this causes some of the on-screen text to be
  12. lost even after the completion is completed, because it has scrolled off
  13. screen. This escape code allows that text to be restored.
  14. If the scrollback buffer is empty or there is no scrollback buffer, such as for
  15. the alternate screen, then the newly inserted lines must be empty, just as with
  16. the original ``SD`` escape code. The maximum number of lines that can be
  17. scrolled down is implementation defined, but must be at least one screen worth.
  18. The syntax of the escape code is identical to that of ``SD`` except that it has
  19. a trailing ``+`` modifier. This is legal under the `ECMA 48 standard
  20. <https://www.ecma-international.org/publications-and-standards/standards/ecma-48/>`__
  21. and unused for any other purpose as far as I can tell. So for example, to
  22. unscroll three lines, the escape code would be::
  23. CSI 3 + T
  24. See `discussion here
  25. <https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/30>`__.
  26. .. versionadded:: 0.20.2
  27. Also supported by the terminals:
  28. * `mintty <https://github.com/mintty/mintty/releases/tag/3.5.2>`__