diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-02-08 04:49:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 04:49:44 +0000 |
commit | ecd9270ffea36a224e70564604ef1befe05526b8 (patch) | |
tree | e0df8b5421f206fa1eb34ecd06652aab0b0b5de1 /src | |
parent | 153f9257b8a78432e9a7830f1eb3c539716f6724 (diff) | |
download | alacritty-ecd9270ffea36a224e70564604ef1befe05526b8.tar.gz alacritty-ecd9270ffea36a224e70564604ef1befe05526b8.zip |
Remove selections when clearing screen partially
Automatically remove all selections when part of the screen is cleared.
This fixes issues in applications like `less -S` where a selection would
stay around after scrolling horizontally.
XTerm and URxvt both choose to always remove the selection, even if it's
outside of the cleared area, however VTE only clears the selection if
any part of it is inside the cleared area.
To keep things simple, Alacritty has adopted the behavior of XTerm and
URxvt to always clear selections.
This fixes #1644.
Diffstat (limited to 'src')
-rw-r--r-- | src/term/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 76ac9c25..2446f048 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1866,6 +1866,9 @@ impl ansi::Handler for Term { let mut template = self.cursor.template; template.flags ^= template.flags; + // Remove active selections + self.grid.selection = None; + match mode { ansi::ClearMode::Below => { for cell in &mut self.grid[self.cursor.point.line][self.cursor.point.col..] { @@ -1891,9 +1894,7 @@ impl ansi::Handler for Term { } }, // If scrollback is implemented, this should clear it - ansi::ClearMode::Saved => { - self.grid.clear_history(); - } + ansi::ClearMode::Saved => self.grid.clear_history(), } } |