Skip to content

Support choosing the date-format for the history pane's commit date - #693

Merged
hannesa2 merged 1 commit into
masterfrom
choose-the-commit-date-format
Sep 21, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
choose-the-commit-date-format

Conversation

@goneng

@goneng goneng commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

First slice of #680. The date column's format was frozen in the nib
(dateStyle="long" timeStyle="short"), so every row read "19 September
2026 at 14:05" and nothing else was reachable.

  • Add a Date format preference: the system short, medium and long
    styles, plus a free pattern for anyone who wants yyyy-MM-dd HH:mm.
    The default is the long style, so an existing install looks the same.
    The label column has no room to say which list the format belongs to,
    so the tooltip does: "Date format of History-list". It governs the
    Date column alone - the Relative Date column beside it is untouched.
  • Format the column through PBGitCommitDateFormatter, which builds one
    formatter for every row on screen and rebuilds it only when the
    preference moves. The column formats once per visible row, so this
    costs what the nib's formatter cost.
  • Mark the date cells that are already drawn for redraw when the format
    changes. A text field asks its formatter for a string as it draws,
    and the dates themselves do not change, so nothing marks them
    otherwise. Reloading the rows instead does not work here: the column
    is bound to arrangedObjects.date, so a reload re-hands the binding
    the commit it already had, the binding pushes nothing, and every row
    but the selected one keeps the format it was drawn with until it is
    scrolled away and back.
  • Size the column from one reference date rendered in the format in
    force
    - 28 September 2026 at 22:58, a two digit day in a long month
    at a two digit hour - rather than from the dates on screen, so that a
    shorter format gives its room back and a longer one is not clipped the
    moment the list scrolls. It is an estimate the user can drag
    afterwards, and a date rather than a written down string, so it stays
    in the reader's own locale. The date is drawn 2pt in from each edge of
    its cell, so the width is ceil(text * 1.05) + 4, with the header as
    a floor since a pattern can render shorter than the word "Date".
  • A pattern that is empty or all spaces falls back to the long style,
    and the rendered pattern shows under the field, so YYYY and friends
    are visible before they reach the list.
  • Move the Git Executable row to Integration, at the top. It is the
    integration a git client rests on, and it frees the room in General
    that the date rows now take.

The relative-date column, NSRelativeDateTimeFormatter and the other
places a commit date is shown are the later slices of #680 and are not
touched here.

Test plan

  • make unit-test - 166 tests pass, 18 of them new. Ten cover the
    formatter: each style against the system formatter of that name, a
    pattern used as written, an empty pattern falling back, a setting
    outside the enum falling back, a non-date value not formatted, the
    formatter in use following the preference, the change being
    announced, that the sizing date does not depend on today, that it is
    rendered by the format in force, and that it follows the preference.
    Eight cover the redraw and the resize, over a table built in the
    test: that the rows are drawn to begin with, that a format change
    asks every drawn date cell to redraw, that a list with no date column
    is left alone, that the column leaves room around the date, that a
    shorter format narrows it, that the header still fits, that a list
    with nothing to measure is left alone, and that a format change
    through the handler sizes the column. The redraw test was run against
    the previous implementation and fails there.
  • ibtool --errors --warnings --notices on Preferences.xib against
    master: the only new notices are the intrinsic-height one every 17pt
    label in this nib already produces.
  • In the running app: General is 500x334 and Integration 500x306, both
    keeping the 38pt top and 35pt bottom gutters. Picking Custom
    enables the pattern field and the sample becomes 2026-09-19 17:57.
  • Read back out of the compiled nib: the pattern field is
    editable=YES selectable=YES as the guide-column fields beside it
    are, and the tooltip is on both the label and the popup. It was
    neither editable nor selectable before, so enabling it only
    recoloured its text - it could not be clicked into or tabbed to.

@goneng
goneng force-pushed the choose-the-commit-date-format branch from eb565bb to ec0e58e Compare September 19, 2026 15:25
@goneng goneng changed the title Let the history pane's commit date format be chosen Support choosing the date-format for the history pane's commit date Sep 19, 2026
@goneng
goneng force-pushed the choose-the-commit-date-format branch 7 times, most recently from 9bc5fc8 to 1577118 Compare September 19, 2026 20:01
@goneng
goneng marked this pull request as ready for review September 19, 2026 20:21
@hannesa2

Copy link
Copy Markdown
Contributor

00-commit-context-menu.pngscreenshot

this is interesting

@goneng
goneng force-pushed the choose-the-commit-date-format branch 2 times, most recently from 7d1b11e to 5c50418 Compare September 19, 2026 21:56
@goneng

goneng commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

00-commit-context-menu.pngscreenshot

this is interesting

yes - looks like an image-compression issue... we need to confirm it is done in a "lossless" format.
Also investigating relation to dialog-transparency that may give random/inconsistent results on consecutive runs.

@goneng

goneng commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator Author

Chasing the diff images here turned up a separate app bug: the sidebar's checked-out badge is baked from the window's main state and never refreshed, so two runs of the same commit can differ by a few hundred pixels. Draft fix in #697.

That removes one real source of screenshot noise here. The other one in these images is the context menu's translucency, where every differing pixel is off by exactly 1/255 - still open.

@goneng
goneng force-pushed the choose-the-commit-date-format branch from 5c50418 to 588a240 Compare September 20, 2026 10:12
@goneng
goneng marked this pull request as draft September 20, 2026 10:13
@goneng goneng added the WIP Work in progress label Sep 20, 2026
goneng added a commit that referenced this pull request Sep 20, 2026
Narrow the previous bisect further, now that removing #693's two new
test suites left PBGitWindowWiringTests failing on macos-26 just the
same, so the cause is the application change rather than the tests.

* keep PBGitCommitDateFormatter and the defaults it reads, so the nib
  has a class to instantiate
* keep the one line in PBGitHistoryView.xib that swaps the date
  column's dateFormatter for that custom formatter
* drop the history controller's notification observer and column
  resize, and the preferences UI, so nothing listens for a format
  change and only the formatter itself is live

Red here means the formatter the date column now builds is enough to
disturb the suite. Green means the history controller's observer is
what matters, and that the notification really does fire mid-run.
@goneng goneng added enhancement and removed WIP Work in progress labels Sep 20, 2026
@goneng
goneng marked this pull request as ready for review September 20, 2026 21:56
@goneng
goneng force-pushed the choose-the-commit-date-format branch from 588a240 to d3cb482 Compare September 21, 2026 05:25
…issue #680)

The date column's format was frozen in the nib, so every row read
"19 September 2026 at 14:05" and there was no way to ask for anything else.

* Add a Date format preference offering the system short, medium and
  long styles plus a free pattern, defaulting to the long style the
  column has always shown. Its tooltip says which list the format
  belongs to, since the label has no room to.
* Format the column through PBGitCommitDateFormatter, which builds one
  formatter for every row on screen and rebuilds it only when the
  preference moves.
* Mark the date cells that are already drawn for redraw when the format
  changes. A text field asks its formatter for a string as it draws,
  and the dates themselves do not change, so nothing else marks them.
* Estimate the column width from one reference date rendered in the
  format in force, rather than from the dates on screen, so that a
  shorter format gives its room back and a longer one is not clipped
  the moment the list scrolls. It is an estimate the user can drag
  afterwards, and a date rather than a written down string, so that it
  stays in the reader's own locale.
* Fall back to the long style for a pattern that is empty or all
  spaces, and show the rendered pattern under the field, so a pattern
  that does not say what its author meant is visible before it reaches
  the list.
* Move the Git Executable row to Integration and put it first: it is
  the integration a git client rests on, and it frees the room in
  General that the date rows now take.
@goneng
goneng force-pushed the choose-the-commit-date-format branch from d3cb482 to f9e8f18 Compare September 21, 2026 06:27
@goneng
goneng requested a review from hannesa2 September 21, 2026 07:27
@hannesa2
hannesa2 merged commit 6920436 into master Sep 21, 2026
3 checks passed
@hannesa2
hannesa2 deleted the choose-the-commit-date-format branch September 21, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants