aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/renderer/mod.rs34
2 files changed, 26 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6801762..7db85331 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `Maximized` startup mode not filling the screen properly on GNOME Wayland
- `OptionAsAlt` with `OnlyLeft`/`OnlyRight` settings not working properly on macOS
- Default Vi key bindings for `Last`/`First` actions not working on X11/Wayland
+- Cut off wide characters in preedit string
### Removed
diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs
index 64aee821..fc586dc9 100644
--- a/alacritty/src/renderer/mod.rs
+++ b/alacritty/src/renderer/mod.rs
@@ -8,6 +8,7 @@ use glutin::context::{ContextApi, GlContext, PossiblyCurrentContext};
use glutin::display::{GetGlDisplay, GlDisplay};
use log::{debug, error, info, warn, LevelFilter};
use once_cell::sync::OnceCell;
+use unicode_width::UnicodeWidthChar;
use alacritty_terminal::index::Point;
use alacritty_terminal::term::cell::Flags;
@@ -175,15 +176,30 @@ impl Renderer {
size_info: &SizeInfo,
glyph_cache: &mut GlyphCache,
) {
- let cells = string_chars.enumerate().map(|(i, character)| RenderableCell {
- point: Point::new(point.line, point.column + i),
- character,
- extra: None,
- flags: Flags::empty(),
- bg_alpha: 1.0,
- fg,
- bg,
- underline: fg,
+ 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;
+ }
+
+ Some(RenderableCell {
+ point: Point::new(point.line, point.column + i),
+ character,
+ extra: None,
+ flags: Flags::empty(),
+ bg_alpha: 1.0,
+ fg,
+ bg,
+ underline: fg,
+ })
});
self.draw_cells(size_info, glyph_cache, cells);