mirror of
https://github.com/alacritty/alacritty.git
synced 2026-11-30 09:00:36 +03:00
Skip whitespaces for wide chars in preedit
While we skip the spacers for the wide characters in the grid due to them having a proper flags, the draw_string method was generating the cells with incorrect flags leading to wide chars being cut off.
This commit is contained in:
1 parent
0c94e4ae7b
commit
67a433ceed
2 files changed
+26
-9
No files matched your search
@@ -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
|
- `Maximized` startup mode not filling the screen properly on GNOME Wayland
|
||||||
- `OptionAsAlt` with `OnlyLeft`/`OnlyRight` settings not working properly on macOS
|
- `OptionAsAlt` with `OnlyLeft`/`OnlyRight` settings not working properly on macOS
|
||||||
- Default Vi key bindings for `Last`/`First` actions not working on X11/Wayland
|
- Default Vi key bindings for `Last`/`First` actions not working on X11/Wayland
|
||||||
|
- Cut off wide characters in preedit string
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use glutin::context::{ContextApi, GlContext, PossiblyCurrentContext};
|
|||||||
use glutin::display::{GetGlDisplay, GlDisplay};
|
use glutin::display::{GetGlDisplay, GlDisplay};
|
||||||
use log::{debug, error, info, warn, LevelFilter};
|
use log::{debug, error, info, warn, LevelFilter};
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
|
use unicode_width::UnicodeWidthChar;
|
||||||
|
|
||||||
use alacritty_terminal::index::Point;
|
use alacritty_terminal::index::Point;
|
||||||
use alacritty_terminal::term::cell::Flags;
|
use alacritty_terminal::term::cell::Flags;
|
||||||
@@ -175,15 +176,30 @@ impl Renderer {
|
|||||||
size_info: &SizeInfo,
|
size_info: &SizeInfo,
|
||||||
glyph_cache: &mut GlyphCache,
|
glyph_cache: &mut GlyphCache,
|
||||||
) {
|
) {
|
||||||
let cells = string_chars.enumerate().map(|(i, character)| RenderableCell {
|
let mut skip_next = false;
|
||||||
point: Point::new(point.line, point.column + i),
|
let cells = string_chars.enumerate().filter_map(|(i, character)| {
|
||||||
character,
|
if skip_next {
|
||||||
extra: None,
|
skip_next = false;
|
||||||
flags: Flags::empty(),
|
return None;
|
||||||
bg_alpha: 1.0,
|
}
|
||||||
fg,
|
|
||||||
bg,
|
let mut flags = Flags::empty();
|
||||||
underline: fg,
|
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);
|
self.draw_cells(size_info, glyph_cache, cells);
|
||||||
|
|||||||
Reference in new issue
Block a user