diff --git a/wezterm-gui/src/gui/shapecache.rs b/wezterm-gui/src/gui/shapecache.rs index c9ea5ca8f..bc10a3981 100644 --- a/wezterm-gui/src/gui/shapecache.rs +++ b/wezterm-gui/src/gui/shapecache.rs @@ -48,10 +48,18 @@ where infos: &[GlyphInfo], glyphs: &[Rc>], ) -> Vec> { - let mut pos = vec![]; + let mut pos: Vec> = vec![]; let mut run = None; for (info, glyph) in infos.iter().zip(glyphs.iter()) { if !info.is_space && glyph.texture.is_none() { + if let Some(shaped) = pos.last_mut() { + if shaped.pos.bitmap_pixel_width as f32 > shaped.pos.bearing_x { + // This space-like glyph belongs to the preceding glyph + shaped.pos.num_cells += 1; + continue; + } + } + if run.is_none() { run.replace(ShapedInfo { pos: GlyphPosition { @@ -121,6 +129,14 @@ where }); } } + if let Some(run) = run.take() { + log::warn!( + "leftovers when shaping {:#?} {:#?} -> {:?}", + infos, + glyphs, + run + ); + } pos } }