parser: stringify log/evolog prefixes to be color agnostic#413
Merged
idursun merged 1 commit intoidursun:mainfrom Dec 7, 2025
Merged
parser: stringify log/evolog prefixes to be color agnostic#413idursun merged 1 commit intoidursun:mainfrom
idursun merged 1 commit intoidursun:mainfrom
Conversation
Previously, in PR idursun#372, ChangeID/CommitID/IsDivergent is added to jj log/evolog commands to allow fetching these revision metadata natively with jj's template. However, the change didn't take into consideration of different color formatting of ChangeID/CommitID/IsDivergent and treated each of them as different `screen.Segment`s. When user configures them to be the same color, ChangeID/CommitID/IsDivergent are actually returned as one chunk by jj and it becomes one `screen.Segment`. Hence the previous change breaks. This commit updates `ChangeID/CommitID/IsDivergent` prefixes with jj's `stringify` method, allowing them to be returned by jj consistently as one single chunk of text without color escape sequence. this way, `ChangeID/CommitID/IsDivergent` are always treated as one `screen.Segment` in jjui. Also, `_PREFIX:` is added to the template for easier separation and parsing of prefixes. Fixes idursun#411
idursun
approved these changes
Dec 7, 2025
Owner
idursun
left a comment
There was a problem hiding this comment.
Thanks!
I kicked the tires and seems to be working fine ![]()
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Dec 12, 2025
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [idursun/jjui](https://github.com/idursun/jjui) | patch | `v0.9.7` -> `v0.9.8` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>idursun/jjui (idursun/jjui)</summary> ### [`v0.9.8`](https://github.com/idursun/jjui/releases/tag/v0.9.8) [Compare Source](idursun/jjui@v0.9.7...v0.9.8) #### Release Summary This release includes experimental Lua scripting support for custom commands, several bug fixes, and UI improvements. The streaming command handler has been reworked to remove the 100ms delay incurred on every refresh (you should feel the difference), and issues with leader keys, parser colour handling, and preview panel focus have been resolved. ##### Key Highlights **🚀 Major Features** - **Lua Scripting in Custom Commands ([#​415](idursun/jjui#415: Experimental support for writing custom commands using Lua scripts. Initial version includes API for revision navigation, JJ command execution, clipboard operations, revset manipulation and displaying flash messages. These are the currently available functions but expect the list to grow and change with each release. **Available Functions (v1)**: - `revisions.current()` - Get currently selected change ID - `revisions.checked()` - Get list of checked change IDs - `revisions.refresh({keep_selections?, selected_revision?})` - Refresh revisions view - `revisions.navigate({by?, page?, target?, to?, fallback?, ensureView?, allowStream?})` - Navigate revisions - `revisions.start_squash({files?})` - Begin squash workflow - `revisions.start_rebase({source?, target?})` - Start rebase operation - `revisions.open_details()` - Open revision details view - `revisions.start_inline_describe()` - Open inline describe editor - `revset.set(value)` - Set custom revset - `revset.reset()` - Reset to default revset - `revset.current()` - Get active revset string - `revset.default()` - Get default revset string - `jj_async({...})` - Run JJ command asynchronously - `jj({...})` - Run JJ command synchronously (returns output, err) - `flash(message)` - Display flash message - `copy_to_clipboard(text)` - Copy text to clipboard Here are a couple of examples: - Appends `| ancestors(<change id of the current revisions>, 2)` to the end of revset and bumps the number with each execution ```toml [custom_commands.append_to_revset] key = ["+"] lua = ''' local change_id = revisions.current() if not change_id then return end local current = revset.current() local bumped = false local updated = current:gsub("ancestors%(" .. change_id .. "%s*,%s*(%d+)%)", function(n) bumped = true return "ancestors(" .. change_id .. ", " .. (tonumber(n) + 1) .. ")" end, 1) if not bumped then updated = current .. "| ancestors(" .. change_id .. ", 2)" end revset.set(updated) ''' ``` - Inserts a new commit after the selected one and then starts inline describe on the new revision. ```toml [custom_commands.new_then_describe] key = ["N"] lua = ''' jj("new", "-A", revisions.current()) revisions.refresh() local new_change_id = jj("log", "-r", "@​", "-T", "change_id.shortest()", "--no-graph") revisions.navigate{to=new_change_id} revisions.start_inline_describe() ''' ``` - Copy to clipboard example ```toml [custom_commands.copy_to_clipboard] key = ["X"] lua = ''' local selections = revisions.checked() if #selections == 0 then flash("none selected") end local content = table.concat(selections, ",") copy_to_clipboard(content) ''' ``` **✨ Enhancements** - **Key Sequences for Custom Commands ([#​420](idursun/jjui#420: Custom commands can now be triggered with multi-key sequences using `key_sequence` property. Also adds `desc` property for command descriptions. An overlay shows available sequences after pressing the first key. Example: ```toml [custom_commands.bookmark_list] key_sequence = ["w", "b", "l"] desc = "bookmarks list" lua = ''' revset.set("bookmarks() | remote_bookmarks()") ''' ``` - **Faster Refresh ([#​412](idursun/jjui#412: Improved streaming command handling, eliminating 100ms delay and making refreshes instant. Previously jjui would fail to launch or get stuck when jj emitted warning messages (e.g., deprecated config options like `git.push-new-bookmarks`). - **Quick Search Highlighting ([#​414](idursun/jjui#414: Case-insensitive search with visual highlighting of all matches in the revisions view - **Remember Unsaved Descriptions ([#​417](idursun/jjui#417: Descriptions are now preserved when you cancel, preventing accidental loss of work. Addresses the common frustration of accidentally hitting ESC and losing long commit messages with no way to recover them. - **Squash Operation Toggle ([#​405](idursun/jjui#405: New `--use-destination-message` option for squash operations **🐛 Bug Fixes** - **Preview Panel Focus Issue ([#​390](idursun/jjui#390: Fixed preview panel showing full commit diff instead of selected file diff when terminal regains focus - **EOF Error Handling ([#​418](idursun/jjui#418: Proper error messages when revset contains no revisions instead of getting stuck - **Parser Color Agnostic ([#​413](idursun/jjui#413: Fixed parsing issues when users configure ChangeID/CommitID/IsDivergent with same colors. - **Leader Key Timing ([#​416](idursun/jjui#416: Fixed leader key processing to prevent race conditions. Leader keys were completely non-functional in versions after v0.9.3 - the options would appear in the UI but do nothing when selected. **🎨 UI/UX Improvements** - Clear selected revisions with ESC key when not in editing/overlay/focused operations ([#​419](idursun/jjui#419)) - Better menu spacing for git and bookmarks - Reduced preview debounce time back to 50ms for snappier response ([#​410](idursun/jjui#410)). The 200ms debounce made the UI feel sluggish when navigating between revisions. **⚙️ Internal Improvements** - Introduced intent-based architecture for better separation of concerns (only implemented for revisions, flash for now) - Moved flash intents to dedicated package - Simplified details view rendering - Better configuration organisation #### What's Changed - operation: Add use destination message to squash operation by [@​woutersmeenk](https://github.com/woutersmeenk) in [#​405](idursun/jjui#405) - Preview panel shows whole commit diff instead of selected file's diff when terminal regains focus by [@​abourget](https://github.com/abourget) in [#​390](idursun/jjui#390) - fix(streamer): handle warning messages by [@​idursun](https://github.com/idursun) in [#​412](idursun/jjui#412) - parser: stringify log/evolog prefixes to be color agnostic by [@​baggiiiie](https://github.com/baggiiiie) in [#​413](idursun/jjui#413) - revisions: add highlight to QuickSearch, make search case insensitive by [@​baggiiiie](https://github.com/baggiiiie) in [#​414](idursun/jjui#414) - feat: Lua scripting in custom commands by [@​idursun](https://github.com/idursun) in [#​415](idursun/jjui#415) - revisions: handle EOF error for revset without revisions by [@​baggiiiie](https://github.com/baggiiiie) in [#​418](idursun/jjui#418) - revisions: clear selected revisions on cancel by [@​baggiiiie](https://github.com/baggiiiie) in [#​419](idursun/jjui#419) - feat: custom commands with sequence keys by [@​idursun](https://github.com/idursun) in [#​420](idursun/jjui#420) #### New Contributors - [@​woutersmeenk](https://github.com/woutersmeenk) made their first contribution in [#​405](idursun/jjui#405) - [@​abourget](https://github.com/abourget) made their first contribution in [#​390](idursun/jjui#390) **Full Changelog**: <idursun/jjui@v0.9.7...v0.9.8> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Ny4wIiwidXBkYXRlZEluVmVyIjoiNDIuNDcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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.
Previously, in PR #372, ChangeID/CommitID/IsDivergent is added to jj log/evolog commands to allow fetching these revision metadata natively with jj's template.
However, the change didn't take into consideration of different color formatting of ChangeID/CommitID/IsDivergent and treated each of them as different
screen.Segments.When user configures them to be the same color,
ChangeID/CommitID/IsDivergent are actually returned as one chunk by jj and it becomes one
screen.Segment. Hence the previous change breaks.This commit updates
ChangeID/CommitID/IsDivergentprefixes with jj'sstringifymethod, allowing them to be returned by jj consistently as one single chunk of text without color escape sequence. this way,ChangeID/CommitID/IsDivergentare always treated as onescreen.Segmentin jjui.Also,
_PREFIX:is added to the template for easier separation and parsing of prefixes.Fixes #411