Repository navigation
fix: JJ Bookmarks on merges, speed k-boundary, and time cursor on timers - #688
Open
eric-engberg wants to merge 5 commits into
Open
eric-engberg wants to merge 5 commits into
eric-engberg wants to merge 5 commits into
Conversation
JJ Bookmarks lists the bookmarks of heads(::@ & bookmarks()) with the template "bookmarks". jj log --no-graph prints each commit's template output back to back with nothing in between, so when @ sits on a merge of two bookmarked heads the names ran together: "feature-afeature-b". The template now ends each head's output with a newline, which the whitespace split already handles; bookmarks on one commit were always space-separated and still are.
formatSpeed switched to "k" at exactly 1000 t/s, but values just below round up when shown: 999.96 t/s rendered as "1000.0 t/s" instead of "1.0k t/s" (and 999.6 as "1000 t/s" with whole numbers). It now switches once the value would round to 1000 at the shown precision, 1000 - 0.5 / 10^decimals, the same boundary formatTokens uses for "M".
The time cursor is a usage bar setting (cursor metadata), and the widget picker keeps metadata when it changes a widget's type. After changing a usage bar with the cursor on to Block Timer, Block Reset Timer or Extra Usage Utilization, the editor row said "time cursor", though those widgets never draw one and have no key to turn it off. The modifier text now lists the cursor only for widgets that ask for it, as it already does for compact and date: the usage percent widgets, which draw it. The metadata itself is left alone, so changing back to a usage bar keeps the setting.
String.raw shows the template exactly as jj reads it, "\n" included, instead of a doubled backslash.
The three time-cursor tests compared the whole modifier text, so they'd also break on any change to how the bar mode itself is described. They now check the part they're about: the bar mode still shows, and the time cursor doesn't.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
🔖 feature-a, feature-binstead of🔖 feature-afeature-bwhen@sits on a merge of two bookmarked heads.kwhere the value would round up to 1000: 999.96 t/s shows1.0k t/sinstead of1000.0 t/s.Why
jj log --no-graph -r 'heads(::@ & bookmarks())' --template bookmarks.jj logprints each commit's template output back to back, with nothing in between, so two heads givefeature-afeature-b. The widget splits on whitespace, which only separates bookmarks on the same commit.formatSpeedcompared against exactly 1000, then rendered with one decimal, so 999.95–999.99 rounded up inside the "t/s" range:formatSpeed(999.96)returned1000.0 t/s. The same happens at any precision: with whole numbers, 999.6 rendered as1000 t/s.formatTokensalready moves up a unit at the rounding boundary (999,950 tokens is1.0M, not1000.0k).cursormetadata flag of the usage bars (Session Usage, Weekly Usage and the per-model weekly widgets). Changing a widget's type in the picker keeps its metadata, and the shared modifier text listed "time cursor" for any widget in a bar mode with the flag set. So after turning a Session Usage long bar with the cursor on into a Block Timer, the editor row readBlock Timer (long bar, time cursor), with no cursor drawn and no(t)key to clear it.How
bookmarks ++ "\n", so each head's output ends with a newline. The whitespace split then works across heads as it already did within one, and the output for a single head is unchanged.formatSpeedswitches tokat1000 - 0.5 / 10 ** decimals, using the effective decimals of the widget's number format: 999.95 by default, 999.5 for whole numbers, 999.995 at two decimals. This is the same boundaryformatTokensuses forM. Values below the boundary and allkvalues render as before. There's noMtier for speeds, so values from 999,950 t/s up still read1000.0k t/sand above, as before.includeCursoroption, likeincludeCompactandincludeDate, and only the usage percent widgets pass it, since they are the ones that draw the cursor. The metadata itself is left alone, so changing back to a usage bar keeps the cursor setting. The editor row of the usage bars is unchanged.Demo
The status line piped from a sample transcript (99,996 output and 99,994 input tokens over 100 s) with a stub
jjstanding in for a repo where@is a merge of two bookmarked heads. jj isn't installed here; the stub prints whatjj log --no-graphprints for each template, one head's output after the other. Input Speed (999.9 t/s) and Total Speed (2.0k t/s) are unchanged.Powerline: before
Powerline: after
Plain: before
Plain: after
In the TUI, a Session Usage long bar with the time cursor on is changed to Block Timer in the type picker (sample preview data):
Powerline: before
Powerline: after
Plain: before
Plain: after
Testing
mainfirst: JJ Bookmarks on two heads (the template and the parsed output); speeds at the boundary by default (999.96, 999.99 vs 999.94), with whole numbers (999.6 vs 999.4) and at two decimals (999.996 vs 999.994); the modifier text of Block Timer, Block Reset Timer and Extra Usage Utilization with carried-over cursor metadata. The existing test for the usage bars' "time cursor" modifier still passes.bun test: 2788 pass, 0 fail.bun run lintpasses.main).jj: all runtimes give identical output in plain and Powerline modes, and it differs frommainonly in Output Speed and JJ Bookmarks. With a Session Usage bar with the cursor on, and with the baseline line, the output matchesmain. The TUI opens and exits cleanly under both.