From 741ee2ec5b4490a9187adb66c76ed00293bf9ec0 Mon Sep 17 00:00:00 2001 From: Andy Dixon Date: Mon, 12 Oct 2026 08:59:32 +0100 Subject: [PATCH] fix: draw accented and other non-ASCII glyphs on the same baseline as ASCII text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-ASCII cells were centred vertically in the cell while ASCII runs were top-anchored; the cell height is the row height rounded up, so é, ñ, €, box-drawing and similar glyphs sat lower than their neighbours (more visibly at larger sizes and on HiDPI). Combining marks on an ASCII base (e + U+0301, as macOS filenames use) were also dropped by the ASCII run path; such cells are now drawn individually with their marks. --- rust/app/src/terminal.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rust/app/src/terminal.rs b/rust/app/src/terminal.rs index 7fc690b..dbb398c 100644 --- a/rust/app/src/terminal.rs +++ b/rust/app/src/terminal.rs @@ -627,14 +627,16 @@ impl TermView { } let hidden = cell.flags.contains(Flags::HIDDEN); let chr = if hidden { ' ' } else { cell.c }; - // ASCII runs share one text call; anything else is placed on its own cell so a - // fallback font's advance can't push later glyphs off the grid. - if chr.is_ascii() && width == 1.0 && fg == run_color && !run.is_empty() { + // ASCII runs share one text call; anything else (including ASCII with combining + // marks) is placed on its own cell so a fallback font's advance can't push later + // glyphs off the grid. + let plain = chr.is_ascii() && width == 1.0 && cell.zerowidth().is_none(); + if plain && fg == run_color && !run.is_empty() { run.push(chr); continue; } flush(&mut run, run_x, run_color); - if chr.is_ascii() && width == 1.0 { + if plain { run.push(chr); run_x = x; run_color = fg; @@ -643,7 +645,9 @@ impl TermView { if let Some(z) = cell.zerowidth() { s.extend(z); } - painter.text(cell_rect.center(), egui::Align2::CENTER_CENTER, s, font.clone(), fg); + // Top-anchored like the ASCII runs: centring vertically in the (rounded-up) + // cell height drew accented and other non-ASCII glyphs below the baseline. + painter.text(pos2(cell_rect.center().x, y), egui::Align2::CENTER_TOP, s, font.clone(), fg); } } flush(&mut run, run_x, run_color);