From 6ca4f2e08d323b26940704eca89bdc71b4ed0160 Mon Sep 17 00:00:00 2001 From: Florrie Date: Fri, 25 Jan 2019 09:10:14 -0400 Subject: Expose xterm alternate screen --- util/ansi.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'util') diff --git a/util/ansi.js b/util/ansi.js index e7f7642..f30e6ff 100644 --- a/util/ansi.js +++ b/util/ansi.js @@ -123,6 +123,20 @@ const ansi = { return `${ESC}[6n` }, + enableAlternateScreen() { + // Enables alternate screen: + // "Xterm maintains two screen buffers. The normal screen buffer allows + // you to scroll back to view saved lines of output up to the maximum set + // by the saveLines resource. The alternate screen buffer is exactly as + // large as the display, contains no additional saved lines." + + return `${ESC}[?1049h` + }, + + disableAlternateScreen() { + return `${ESC}[?1049l` + }, + measureColumns(text) { // Returns the number of columns the given text takes. -- cgit 1.3.0-6-gf8a5