diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-11-15 03:28:03 +0300 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2020-11-15 01:03:38 +0000 |
commit | 256be5b95be58dc56ade432b0f3fce668e397d12 (patch) | |
tree | d76061980cc0d79252e1edfe0ee85f35efd1b7be | |
parent | e52318047185a220977ae28b27ee6988fac18b09 (diff) | |
download | alacritty-256be5b95be58dc56ade432b0f3fce668e397d12.tar.gz alacritty-256be5b95be58dc56ade432b0f3fce668e397d12.zip |
Fix zerowidth characters in the last column
This commit fixes the issue that when attempting to write zerowidth
characters into the last column, it is written in the second to last
column instead.
Fixes #4227.
Co-authored-by: Christian Duerr <contact@christianduerr.com>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 328da070..42be6d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Crash when writing to the clipboard fails on Wayland - Crash with large negative `font.offset.x/y` - Visual bell getting stuck on the first frame +- Zerowidth characters in the last column of the line ## 0.5.0 diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 6e20f0e1..cdcfad9d 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1480,11 +1480,18 @@ impl<T: EventListener> Handler for Term<T> { // Handle zero-width characters. if width == 0 { - let mut col = self.grid.cursor.point.col.0.saturating_sub(1); + // Get previous column. + let mut col = self.grid.cursor.point.col.0; + if !self.grid.cursor.input_needs_wrap { + col = col.saturating_sub(1); + } + + // Put zerowidth characters over first fullwidth character cell. let line = self.grid.cursor.point.line; if self.grid[line][Column(col)].flags.contains(Flags::WIDE_CHAR_SPACER) { col = col.saturating_sub(1); } + self.grid[line][Column(col)].push_zerowidth(c); return; } |