Skip to content

Hourglass: align center to farther-right '|' and pad header/footer#93

Merged
matsuokashuhei merged 3 commits into
mainfrom
hourglass-III
Aug 30, 2025
Merged

Hourglass: align center to farther-right '|' and pad header/footer#93
matsuokashuhei merged 3 commits into
mainfrom
hourglass-III

Conversation

@matsuokashuhei
Copy link
Copy Markdown
Owner

@matsuokashuhei matsuokashuhei commented Aug 30, 2025


Before/After

Date range (top is longer):

Before:

2025-01-01 → 2025-12-31   |   66%
           ┏━━━━━━━━━┓
           …
          elapsed: 241d   |   remaining: 123d

After:

2025-01-01 → 2025-12-31   |   66%
                     ┏━━━━━━━━━┓
                     …
          elapsed: 241d   |   remaining: 123d

Time range (bottom is longer):

Before:

10:00 → 19:00   |   70%
           ┏━━━━━━━━━┓
           …
elapsed: 6h 22m   |   remaining: 2h 37m

After:

  10:00 → 19:00   |   70%
             ┏━━━━━━━━━┓
             …
elapsed: 6h 22m   |   remaining: 2h 37m

Screenshots

Date range (top is longer):

Date range

Time range (bottom is longer):

Time range

…divider\n\n- Compute visual widths via unicode-width to handle wide chars\n- Choose global center from longer of header/footer by display width\n- Pad header/footer and center hourglass to the same column
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment thread src/renderer/hourglass_renderer.rs Outdated
Comment on lines +62 to +67
// Determine visual widths and divider columns using Unicode display width
let (header_width, header_divider) = Self::visual_width_and_divider(&header);
let (footer_width, footer_divider) = Self::visual_width_and_divider(&footer);
let global_center = if header_width >= footer_width {
header_divider
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Center column derived from total width misaligns header

The new global_center picks the divider column from whichever line has the greater total display width. That assumes the longer line’s divider is also farther from the left edge, but when the extra width is on the right side (e.g. footer has a long “remaining …” string while header has longer date text before |), footer_divider can be to the left of header_divider. In that case header_left_pad stays zero and the hourglass is aligned to the smaller footer_divider, so the header’s divider and the hourglass center no longer line up. The center should be chosen based on the maximum divider column (or otherwise account for the left-side widths), not the line with the largest overall width.

Useful? React with 👍 / 👎.

@matsuokashuhei
Copy link
Copy Markdown
Owner Author

Pushed an update: hourglass alignment now anchors to the farther-right info divider (prefers footer on ties), and pads header/footer so their '|' aligns to the hourglass center. Verified with date-range and time-range examples.

@matsuokashuhei matsuokashuhei changed the title Hourglass: center header/hourglass/footer using display widths Hourglass: align center to farther-right '|' and pad header/footer Aug 30, 2025
@matsuokashuhei
Copy link
Copy Markdown
Owner Author

Addressed the review feedback about center derivation: we now choose the center from the farther-right divider column (i.e., max of header/footer divider positions) and pad header/footer accordingly. This fixes cases where extra width is on the right side. See commit b00fcd0 and f4eccd5.

@matsuokashuhei matsuokashuhei merged commit 01eb0be into main Aug 30, 2025
13 checks passed
@matsuokashuhei matsuokashuhei deleted the hourglass-III branch August 30, 2025 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant