diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-05-15 22:36:14 +0200 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:56:50 -0700 |
commit | ac93f6d03198c1826dbed60fa8283aeb8d1a577d (patch) | |
tree | 3cb42b2e911abe85994643359cb12ee634aad820 /src/grid/mod.rs | |
parent | 6cddceb6cde032a79253f0596850c3e3c1c66db7 (diff) | |
download | alacritty-ac93f6d03198c1826dbed60fa8283aeb8d1a577d.tar.gz alacritty-ac93f6d03198c1826dbed60fa8283aeb8d1a577d.zip |
Truncate invisible lines before storing ref-tests
Because there is no good way to store invisible lines in a backwards-
and forwards-compatible way, they buffer now gets truncated before
dumping the state of a grid when creating a ref-test.
This involved a few workaround of which a few required adding additional
methods which are only used in ref-tests, these should be minimal
though.
Since this required the creation of a truncation method anyways, some
logic has been added which automatically truncates the invisible buffer
when there are more than X (set to 100) invisible lines. This should not
impact performance because it rarely occurs, but it could save a bit of
memory when the history size is shrunk during runtime (see #1293).
This also adds an optional `config.json` file to the ref-test output
where it is possible to manually specify variables which should override
config defaults, this has been used only for history_size so far.
Creating a new ref-test does also still work, so there was no regression
here, if history size is altered, the config.json just has to be created
manually with the content `{"history_size":HIST_SIZE}`, where
`HIST_SIZE` is the desired history size.
Diffstat (limited to 'src/grid/mod.rs')
-rw-r--r-- | src/grid/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs index 803f1e6e..0eea4201 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -407,6 +407,11 @@ impl<T> Grid<T> { self.raw.len() } + /// This is used only for truncating before saving ref-tests + pub fn truncate(&mut self) { + self.raw.truncate(); + } + pub fn iter_from(&self, point: Point<usize>) -> GridIterator<T> { GridIterator { grid: self, |