Skip to content

Commit

Permalink
Fix IME preview overlapping text
Browse files Browse the repository at this point in the history
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: 67a433c (Skip whitespaces for wide chars in preedit)
  • Loading branch information
kchibisov committed Apr 21, 2024
1 parent 44dc9e1 commit 9005461
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ Notable changes to the `alacritty_terminal` crate are documented in its

## 0.14.0-dev

### Changed

- Pressing `Alt` with unicode input will now add `ESC` like for ASCII input

### Fixed

- Crash when trying to create a new tab without decorations enabled
- New window being treated as focused when it's not on Wayland

### Changed

- Pressing `Alt` with unicode input will now add `ESC` like for ASCII input
- IME preview blending into text below it

## 0.13.2

Expand Down
31 changes: 15 additions & 16 deletions alacritty/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9005461

Please sign in to comment.