diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-06 12:23:27 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-06 12:23:27 -0500 |
commit | 07ecf81b095cc1f23428f05079d65aa5d1677ca4 (patch) | |
tree | f3f511e933e68644a517deddfe9aac0d93c51d05 | |
parent | 57773f69775b651fe7e89b2473d4fb5e91b2818f (diff) | |
download | vt100-rust-07ecf81b095cc1f23428f05079d65aa5d1677ca4.tar.gz vt100-rust-07ecf81b095cc1f23428f05079d65aa5d1677ca4.zip |
docs
-rw-r--r-- | src/screen.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/screen.rs b/src/screen.rs index d39b406..6aa80ba 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -153,7 +153,8 @@ impl Screen { /// codes. The result will be suitable for feeding directly to a raw /// terminal parser, and will result in the same visual output. Internal /// terminal modes (such as application keypad mode or alternate screen - /// mode) will not be included here. + /// mode) will not be included here, but modes that affect the visible + /// output (such as hidden cursor mode) will. pub fn contents_formatted(&self) -> Vec<u8> { let mut grid_contents = vec![]; if self.hide_cursor() { @@ -188,6 +189,15 @@ impl Screen { }) } + /// Returns a terminal byte stream sufficient to turn the screen described + /// by `prev` into the screen described by `self`. + /// + /// The result of rendering `prev.contents_formatted()` followed by + /// `self.contents_diff(prev)` should be equivalent to the result of + /// rendering `self.contents_formatted()`. This is primarily useful when + /// you already have a terminal parser whose state is described by `prev`, + /// since the diff will likely require less memory and cause less + /// flickering than redrawing the entire screen contents. pub fn contents_diff(&self, prev: &Self) -> Vec<u8> { let mut grid_contents = vec![]; if self.hide_cursor() != prev.hide_cursor() { |