summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-05-17 15:32:06 +0000
committerChristian Duerr <contact@christianduerr.com>2020-05-26 00:02:20 +0000
commit79175527948ee7c1bad20b774cd909e037e77db6 (patch)
tree3fbcd73f950e65865893ae1926e61567ddf5461d
parentda78e7059fccb91e356f397c88af9c2ef7f07d4b (diff)
Fix crash when writing wide char in last column
This resolves an issue where trying to write a fullwidth character in the last column would crash Alacritty, if linewrapping was disabled. Instead of assuming that the linewrap put after the linewrapping spacer was successful, the character writing is now skipped completely when trying to put a wide character in the last column.
-rw-r--r--CHANGELOG.md2
-rw-r--r--alacritty_terminal/src/term/mod.rs12
2 files changed, 11 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ef499ec9..84abd929 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,6 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix escapes prematurely terminated by terminators in unicode glyphs
- Incorrect location when clicking inside an unfocused window on macOS
- Startup mode `Maximized` on Windows
+- Crashing on start on Windows
+- Crash when writing a fullwidth character in the last column with auto-wrap mode disabled
## 0.4.2
### Fixed
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 5db57339..124f56ac 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1343,10 +1343,16 @@ impl<T: EventListener> Handler for Term<T> {
if width == 1 {
self.write_at_cursor(c);
} else {
- // Insert extra placeholder before wide char if glyph doesn't fit in this row anymore
if self.cursor.point.col + 1 >= num_cols {
- self.write_at_cursor(' ').flags.insert(Flags::WIDE_CHAR_SPACER);
- self.wrapline();
+ if self.mode.contains(TermMode::LINE_WRAP) {
+ // Insert placeholder before wide char if glyph does not fit in this row.
+ self.write_at_cursor(' ').flags.insert(Flags::WIDE_CHAR_SPACER);
+ self.wrapline();
+ } else {
+ // Prevent out of bounds crash when linewrapping is disabled.
+ self.input_needs_wrap = true;
+ return;
+ }
}
// Write full width glyph to current cursor cell