From c8d5f232b3d5533f1decc3646a0aeb836276ab09 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Dec 2017 18:08:25 +0530 Subject: [PATCH] Some documentation for the kitty extensions to DECCARA --- protocol-extensions.asciidoc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/protocol-extensions.asciidoc b/protocol-extensions.asciidoc index 2e0364e6d..94dc936e4 100644 --- a/protocol-extensions.asciidoc +++ b/protocol-extensions.asciidoc @@ -156,3 +156,26 @@ For example: This encoding means each key event is represented by 8 or 9 printable ascii only bytes, for maximum robustness. + + +== Setting text styles/colors in arbitrary regions of the screen + +There already exists an escape code to set *some* text attributes in arbitrary +regions of the screen, +link:https://vt100.net/docs/vt510-rm/DECCARA.html[DECCARA]. However, it is +limited to only a few attributes. kitty extends this to work with *all* SGR +attributes. So, for example, this can be used to set the background color in +an arbitrary region of the screen. + +The motivation for this extension is the various problems with the existing +solution for erasing to background color, namely the *background color erase +(bce)* capability. See +link:https://github.com/kovidgoyal/kitty/issues/160#issuecomment-346470545[this discussion] +for a summary of problems with *bce*. + +For example, to set the background color to blue in a +rectangular region of the screen from (3, 4) to (10, 11), you use: + +``` +[2*x[4;3;11;10;44$r[*x +```