From 9c6d12ea2c863ba76015bdedc00db13b7307725a Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 25 Apr 2019 22:26:22 +0000 Subject: [PATCH] Fix position of zero-width over double-width characters --- CHANGELOG.md | 1 + src/term/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6febd06..ba935720 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - PTY size not getting updated when message bar is shown - Text Cursor disappearing +- Incorrect positioning of zero-width characters over double-width characters ## Version 0.3.2 diff --git a/src/term/mod.rs b/src/term/mod.rs index a9a3841f..94b2ade2 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1414,10 +1414,10 @@ impl ansi::Handler for Term { // Handle zero-width characters if width == 0 { - let col = self.cursor.point.col.0.saturating_sub(1); + let mut col = self.cursor.point.col.0.saturating_sub(1); let line = self.cursor.point.line; if self.grid[line][Column(col)].flags.contains(cell::Flags::WIDE_CHAR_SPACER) { - col.saturating_sub(1); + col = col.saturating_sub(1); } self.grid[line][Column(col)].push_extra(c); return;