Revert "font/Metrics: remove original_cell_width, no longer needed"

This reverts commit 23cc50b12c.
pull/8206/head
Qwerasd 2025-08-10 15:20:29 -06:00
parent f56219be95
commit 195cbb6a1c
1 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,10 @@ cursor_height: u32,
/// The constraint height for nerd fonts icons.
icon_height: u32,
/// Original cell width in pixels. This is used to keep
/// glyphs centered if the cell width is adjusted wider.
original_cell_width: ?u32 = null,
/// Minimum acceptable values for some fields to prevent modifiers
/// from being able to, for example, cause 0-thickness underlines.
const Minimums = struct {
@ -263,6 +267,11 @@ pub fn apply(self: *Metrics, mods: ModifierSet) void {
const new = @max(entry.value_ptr.apply(original), 1);
if (new == original) continue;
// Preserve the original cell width if not set.
if (self.original_cell_width == null) {
self.original_cell_width = self.cell_width;
}
// Set the new value
@field(self, @tagName(tag)) = new;