Cretezy / lazyjj

TUI for Jujutsu/jj
Apache License 2.0
34 stars 2 forks source link

Branches with new lines breaks log #29

Closed Cretezy closed 1 month ago

Cretezy commented 1 month ago

Branches with new lines are displayed in the log. Since we have the default log to a template, the lines no longer line up with branches with newlines.

Example with hello\nworld:

$ jj log
@  mlzzrmry charles@cretezy.com 2024-05-27 22:48:41 hello
│  world 2e37276d
│  d

Which doesn't lineup to HEAD_TEMPLATE:

$ jj log -T '"[" ++ change_id ++ "|" ++ commit_id ++ "|" ++ divergent ++ "|" ++ if(immutable, "true", "false") ++ "]" ++ "\n" ++ "[" ++ change_id ++ "|" ++ commit_id ++ "|" ++ divergent ++ "|" ++ if(immutable, "true", "false") ++ "]"'
@  [mlzzrmrymntolvxrxvwxznqukwuotwko|2e37276daf20178d31794ea5bfaacb1edfa8a043|false|false]
│  [mlzzrmrymntolvxrxvwxznqukwuotwko|2e37276daf20178d31794ea5bfaacb1edfa8a043|false|false]

Solution

Append branches to the first line of output:

$ jj log -T '"[" ++ change_id ++ "|" ++ commit_id ++ "|" ++ divergent ++ "|" ++ if(immutable, "true", "false") ++ "]" ++ branches ++ "\n" ++ "[" ++ change_id ++ "|" ++ commit_id ++ "|" ++ divergent ++ "|" ++ if(immutable, "true", "false") ++ "]"'
@  [mlzzrmrymntolvxrxvwxznqukwuotwko|2e37276daf20178d31794ea5bfaacb1edfa8a043|false|false]hello
│  world
│  [mlzzrmrymntolvxrxvwxznqukwuotwko|2e37276daf20178d31794ea5bfaacb1edfa8a043|false|false]

Then we can highlight all lines between the markers.