summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/term/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-05-17 15:32:06 +0000
committerGitHub <noreply@github.com>2020-05-17 15:32:06 +0000
commit395fee2b01d0fe59f5502402e102f50ebfd88cd1 (patch)
treeb1cf8bdc2a4ffa6428f6bfff49f519ca9cd96c2c /alacritty_terminal/src/term/mod.rs
parent922f48e52c5643e7cce0aa72b87170d8f12b5cfa (diff)
downloadalacritty-395fee2b01d0fe59f5502402e102f50ebfd88cd1.tar.gz
alacritty-395fee2b01d0fe59f5502402e102f50ebfd88cd1.zip
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.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r--alacritty_terminal/src/term/mod.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 040c7228..d5759421 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1462,10 +1462,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.