diff --git a/docs/changelog.md b/docs/changelog.md index 452bd6c6c..43b1699bb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -88,6 +88,7 @@ As features stabilize some brief notes about them will accumulate here. * Charselect and repl recency/history were not persisted across restarts. #4047 ?4019 * macOS: system font fallback didn't always find a workable fallback font. #4099 #849 * F13-F24 keys are now supported. Thanks to @ovidiu-ionescu! #3937 +* Strikethrough position was not centered when setting `line_height` #4196 #### Updated * Bundled harfbuzz to 8.1.1 diff --git a/test-data/underlines.sh b/test-data/underlines.sh index 50cfdafc0..7c00b7811 100755 --- a/test-data/underlines.sh +++ b/test-data/underlines.sh @@ -1,6 +1,7 @@ #!/bin/sh printf "\x1b[58:2::255:0:0m\x1b[4:1msingle\x1b[4:2mdouble\x1b[4:3mcurly\x1b[4:4mdotted\x1b[4:5mdashed\x1b[0m\n" +printf "\x1b[9mStRiKeThRoUgH\x1b[0m\n" echo printf "\x1b[58:2::0:255:0m\x1b[53moverline\x1b[0m\n" diff --git a/wezterm-gui/src/utilsprites.rs b/wezterm-gui/src/utilsprites.rs index 31793118d..b50982d1b 100644 --- a/wezterm-gui/src/utilsprites.rs +++ b/wezterm-gui/src/utilsprites.rs @@ -111,7 +111,10 @@ impl RenderMetrics { let descender_plus_two = (2 * underline_height + descender_row).min(cell_height as isize - underline_height); let strike_row = match &config.strikethrough_position { - None => descender_row / 2, + None => { + ((cell_height as f64 + (metrics.descender.get() - underline_position)) / 2.) + as isize + } Some(d) => d .evaluate_as_pixels(DimensionContext { dpi: fonts.get_dpi() as f32,