diff options
author | Joe Wilm <joe@jwilm.com> | 2017-01-10 21:21:19 -0800 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-01-11 09:07:31 -0800 |
commit | dfb1b3bb5c5e9d9d9ee23f3f5bcc84fe6602392d (patch) | |
tree | fd1cbff66bbc40993ddcb89a6b62e53f06652e79 /src/term/mod.rs | |
parent | 4fb7801ba3515922e3dbb8b27c1c28ec2efaf22b (diff) | |
download | alacritty-dfb1b3bb5c5e9d9d9ee23f3f5bcc84fe6602392d.tar.gz alacritty-dfb1b3bb5c5e9d9d9ee23f3f5bcc84fe6602392d.zip |
Add support for setting title from OSC
Resolves #23
Resolves #144
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index cc1715a9..581f5039 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -210,6 +210,11 @@ pub struct Term { /// arrays. Without it we wold have to sanitize cursor.col every time we used it. input_needs_wrap: bool, + /// Got a request to set title; it's buffered here until next draw. + /// + /// Would be nice to avoid the allocation... + next_title: Option<String>, + /// Alternate grid alt_grid: Grid<Cell>, @@ -286,6 +291,11 @@ impl SizeInfo { } impl Term { + #[inline] + pub fn get_next_title(&mut self) -> Option<String> { + self.next_title.take() + } + pub fn new(size: SizeInfo) -> Term { let template = Cell::default(); @@ -304,6 +314,7 @@ impl Term { let scroll_region = Line(0)..grid.num_lines(); Term { + next_title: None, dirty: false, input_needs_wrap: false, grid: grid, @@ -642,6 +653,12 @@ impl ansi::TermInfo for Term { } impl ansi::Handler for Term { + /// Set the window title + #[inline] + fn set_title(&mut self, title: &str) { + self.next_title = Some(title.to_owned()); + } + /// A character to be displayed #[inline] fn input(&mut self, c: char) { |