Hourglass: align center to farther-right '|' and pad header/footer#93
Conversation
…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
There was a problem hiding this comment.
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".
| // 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 { |
There was a problem hiding this comment.
[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 👍 / 👎.
…to match center (prefer footer on ties)
|
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. |
Before/After
Date range (top is longer):
Before:
After:
Time range (bottom is longer):
Before:
After:
Screenshots
Date range (top is longer):
Time range (bottom is longer):