diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-05-30 10:20:47 +0200 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 10:03:42 -0700 |
commit | 4631ca4db5faf10eb0276e3968814a68c86c81ee (patch) | |
tree | fed10fa657047e769a07bd1c7c40a0f19683f669 /src/term/mod.rs | |
parent | 24c50fa0a793cd8c6127b5cf8ba3ea59f47cc1ca (diff) | |
download | alacritty-4631ca4db5faf10eb0276e3968814a68c86c81ee.tar.gz alacritty-4631ca4db5faf10eb0276e3968814a68c86c81ee.zip |
Allow changing scrollback history size at runtime
Making use of the changes that have been introduced in #1234 and #1284,
this allows changing the size of the scrollback buffer at runtime.
This simply changes the size of the raw inner buffer making use of the
optimized mutation algorithms introduced in #1284. As a result,
shrinking the scrollback history size at runtime should be basically
free and growing will only introduce a performance cost when there are
no more buffered lines. However, as a result there will not be any
memory freed when shrinking the scrollback history size at runtime.
As discussed in #1234 a potential solution for this could be to truncate
the raw buffer whenever more than X lines are deleted, however this
issue should not be very significant PR and if a solution is desired a
separate issue/PR should be opened.
This fixes #1235.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index fa204a55..8635c818 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -908,6 +908,8 @@ impl Term { self.default_cursor_style = config.cursor_style(); self.dynamic_title = config.dynamic_title(); self.auto_scroll = config.scrolling().auto_scroll; + self.grid + .update_history(config.scrolling().history as usize, &self.cursor.template); } #[inline] @@ -2020,17 +2022,17 @@ mod tests { mem::swap(&mut term.semantic_escape_chars, &mut escape_chars); { - *term.selection_mut() = Some(Selection::semantic(Point { line: 2, col: Column(1) }, &term)); + *term.selection_mut() = Some(Selection::semantic(Point { line: 2, col: Column(1) })); assert_eq!(term.selection_to_string(), Some(String::from("aa"))); } { - *term.selection_mut() = Some(Selection::semantic(Point { line: 2, col: Column(4) }, &term)); + *term.selection_mut() = Some(Selection::semantic(Point { line: 2, col: Column(4) })); assert_eq!(term.selection_to_string(), Some(String::from("aaa"))); } { - *term.selection_mut() = Some(Selection::semantic(Point { line: 1, col: Column(1) }, &term)); + *term.selection_mut() = Some(Selection::semantic(Point { line: 1, col: Column(1) })); assert_eq!(term.selection_to_string(), Some(String::from("aaa"))); } } |