aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-02-22 02:42:44 +0000
committerGitHub <noreply@github.com>2020-02-22 02:42:44 +0000
commit71dd1bc386d70e42d5e40c6e1d9d6b430dc70b75 (patch)
tree01865db350239fb6526254fe397d08cac849951d
parent8abca441827788d48de49d3552735cdd0999379e (diff)
downloadr-alacritty-71dd1bc386d70e42d5e40c6e1d9d6b430dc70b75.tar.gz
r-alacritty-71dd1bc386d70e42d5e40c6e1d9d6b430dc70b75.tar.bz2
r-alacritty-71dd1bc386d70e42d5e40c6e1d9d6b430dc70b75.zip
Fix block selection including last column
The block selection will now only insert extra newline characters after each line if the last line isn't already included. This resolves an issue with duplicate newlines, since newlines are automatically appended when the last column is part of a selection. Fixes #3304.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty_terminal/src/term/mod.rs7
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2545d393..8bf47af2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Handling of URLs with single quotes
- Parser reset between DCS escapes
- Parser stopping at unknown DEC private modes/SGR character attributes
+- Block selection appending duplicate newlines when last column is selected
### Removed
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index ae1d7151..b2184ad9 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -984,7 +984,12 @@ impl<T> Term<T> {
if is_block {
for line in (end.line + 1..=start.line).rev() {
- res += &(self.line_to_string(line, start.col..end.col, start.col.0 != 0) + "\n");
+ res += &self.line_to_string(line, start.col..end.col, start.col.0 != 0);
+
+ // If the last column is included, newline is appended automatically
+ if end.col != self.cols() - 1 {
+ res += "\n";
+ }
}
res += &self.line_to_string(end.line, start.col..end.col, true);
} else {