Highlight is off if \n in template
I have the following in my .config/jj/config.toml:
[templates]
log = "builtin_log_compact_full_description"
[template-aliases]
description_placeholder = '"(no description)\n"' # Adds LF to top change
because I like an empty line on my current changeset.
lazyjj displays the following:
and when I press the down arrow, this:
It seems, lazyjj is confused by the \n and all highlights below are off by one?
The current implementation is hardcoded use builtin_log_compact and expect it to have an item height of exactly 2 lines. It does use a ratatui List which allows mixed height items, but works around this. The result is what you see.
Proposed fix
It is possible to make a PR which enables users to customize the look of the log list.
This would happen in
- src/ui/log_tab.rs:fn draw()
- src/commander/log.rs:fn get_log()
Changes:
- get_log should use 1, not 2 calls to jj log to get the content. The idea is to combine the user-template with the lazyjj template HEAD_TEMPLATE to a single template.
- Parsing should work on the combined output, to locate start of items.
- Corner case: pause-items, with no commit. E.g. when jj hides a sequence of commits.
- Some refactoring of the relevant parts into separate functions would be nice.
I don't really care about the added space from my template in lazyjj.
Perhaps the easiest fix would be to feed jj with a hardcoded template
from inside lazyjj, so that it can rely on a certain layout?
Also, it's arguably a bug in jj itself. Without the template change, a
jj log looks like this
@ tw ***@***.*** 2025-11-20 12:12:21 c852100b
│ (empty) (no description set)
○ l ***@***.*** 2025-11-20 12:12:21 git_head() 7bbf83cc
│ whatever
│
○ kz ***@***.*** 2025-11-19 10:50:04 52598d49
│ another whatever
│
and it's clearly missing a newline after the first, empty, changeset.
Perhaps this is more a jj bug/cosmetic problem?
I opened https://github.com/jj-vcs/jj/issues/8073 for jj with a better fix than futzing with the placeholder.