Skip to content

feat(cache-timer): add a short time toggle and drop the clock notation - #592

Open
ddelange wants to merge 1 commit into
sirmalloc:mainfrom
ddelange:cache-timer-short-time
Open

ddelange wants to merge 1 commit into
sirmalloc:mainfrom
ddelange:cache-timer-short-time

Conversation

@ddelange

Copy link
Copy Markdown

Problem

Cache Timer is the only timer widget without the shared (s)hort time toggle, and the only one that renders its countdown as clock notation (4:52) instead of labeled units.
Block Timer, Block Reset Timer and Weekly Reset Timer all render 4hr 30m by default and 4h30m with s.

A second gap: a TTL longer than an hour (settable directly in settings.json) rendered as 119:55, which reads as hours to most people.

Change

  • Cache Timer now renders the countdown as 4m 52s, and 4m52s with the new (s)hort time keybind.
    Same key, same toggle-compact action, same compact metadata flag as the reset timers, so the editor annotation reads (compact) there too.
  • Seconds always render, also at 4m 0s, so the widget does not change width every minute.
    This is why the countdown keeps its own formatter instead of calling formatUsageDuration, which drops zero parts.
  • Hour parts appear above an hour remaining: 1hr 59m 55s, or 1h59m55s in short time mode.
  • The clock notation is gone.
    This is the one behavior change for existing users: the default is 2 characters wider, and short time mode is 1 character wider than the old 4:52.
    Happy to keep 4:52 as the default and make s switch to labels instead, if you prefer no default change.

Notes

docs/USAGE.md also now states that Backspace in the glyph editor renders a state without a glyph.
That already worked on Cache Timer, but the docs only mentioned it for the git and jj glyph widgets, so people trying to save width on the bar do not find it.

bun test (2362 pass) and bun run lint are green.

The Cache Timer was the only timer widget without the shared (s) short time
toggle, and the only one rendering its countdown as mm:ss instead of labeled
units. It now renders '4m 52s' by default and '4m52s' in short time mode,
matching Block Timer, Block Reset Timer and Weekly Reset Timer, and it gains
hour parts for TTLs longer than an hour.
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