diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2024-04-21 15:23:10 +0400 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2024-08-14 15:42:41 -0600 |
commit | 1012c64d45e598e53465cbe12a596665ebaf6619 (patch) | |
tree | 862d782b6e9bd868998e004e603be39c78a45070 /alacritty/src | |
parent | dcb0b491a00e3dd0f0d41e3ab6275dff09a82e48 (diff) | |
download | r-alacritty-1012c64d45e598e53465cbe12a596665ebaf6619.tar.gz r-alacritty-1012c64d45e598e53465cbe12a596665ebaf6619.tar.bz2 r-alacritty-1012c64d45e598e53465cbe12a596665ebaf6619.zip |
Fix IME preview overlapping text
Fix incorrect usage of the `flags` when drawing the preedit resulting
in setting the `flags`, but not actually reading the value back.
The logic to skip things was also used incorrectly, because the renderer
does that already based on the `WIDE_CHAR` flag on the cell.
Fixes: 67a433ceed (Skip whitespaces for wide chars in preedit)
Diffstat (limited to 'alacritty/src')
-rw-r--r-- | alacritty/src/renderer/mod.rs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index 02bfd762..f4f1397f 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -205,30 +205,29 @@ impl Renderer { size_info: &SizeInfo, glyph_cache: &mut GlyphCache, ) { - let mut skip_next = false; - let cells = string_chars.enumerate().filter_map(|(i, character)| { - if skip_next { - skip_next = false; - return None; - } - - let mut flags = Flags::empty(); - if character.width() == Some(2) { - flags.insert(Flags::WIDE_CHAR); - // Wide character is always followed by a spacer, so skip it. - skip_next = true; - } + let mut wide_char_spacer = false; + let cells = string_chars.enumerate().map(|(i, character)| { + let flags = if wide_char_spacer { + wide_char_spacer = false; + Flags::WIDE_CHAR_SPACER + } else if character.width() == Some(2) { + // The spacer is always following the wide char. + wide_char_spacer = true; + Flags::WIDE_CHAR + } else { + Flags::empty() + }; - Some(RenderableCell { + RenderableCell { point: Point::new(point.line, point.column + i), character, extra: None, - flags: Flags::empty(), + flags, bg_alpha: 1.0, fg, bg, underline: fg, - }) + } }); self.draw_cells(size_info, glyph_cache, cells); |