fix(revisions): avoid toggle-select panic on empty revisions#636
Merged
Conversation
Bug: Pressing the revisions toggle-select action could panic with "noindex out of range [0] with length 0" when the revisions list was empty. The handler indexed m.rows[m.cursor] directly even when there was no selected row. How to reproduce: 1. Open jjui with a revset or search that yields no matching revisions. 2. Press the revisions toggle-select binding (space). 3. jjui panics from revisions.HandleIntent while handling RevisionsToggleSelect. Fix: Use SelectedRevision() instead of indexing m.rows directly. That centralizes the bounds check and returns nil when no revision is selected, so toggle-select becomes a safe no-op for the empty-list case. Add a regression test to lock in that behavior.
idursun
approved these changes
Apr 17, 2026
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Apr 21, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [idursun/jjui](https://github.com/idursun/jjui) | patch | `v0.10.2` → `v0.10.3` | 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.10.3`](https://github.com/idursun/jjui/releases/tag/v0.10.3) [Compare Source](idursun/jjui@v0.10.2...v0.10.3) This release includes new Lua customisation support, repo-local configuration, preview sizing improvements, and a set of UI fixes. There were also some internal changes around action routing and rendering, so if something feels broken or behaves differently, please let me know. #### Features ##### Repository-local configuration Repository-local configuration is now supported. You can add `.jjui/config.toml` or `.jjui/config.lua` to a repository to customise jjui for that repo while still inheriting global configuration. This is useful for repo-specific revsets, limits, bindings, and Lua configuration. `JJUI_CONFIG_DIR` remains a hard override when set. [#​609](idursun/jjui#609) ##### Lua editor metadata Lua scripting now has installable editor metadata. Run `jjui --install-lua-types` to write generated `types.lua` metadata to your jjui config directory and create `.luarc.json` for LuaLS when one does not already exist. This gives Lua users autocomplete and basic type information for `config.lua`, plugins, and embedded Lua scripts. [#​617](idursun/jjui#617) ##### Preview pane sizing Preview commands now receive the preview pane size through `COLUMNS` and `LINES`. Width-sensitive tools such as `difft`, and configured `delta` setups, can now wrap output to the jjui preview pane instead of the outer terminal width. [#​608](idursun/jjui#608) ##### Layered revision operations Revision operations can now be layered more naturally, with active operation scopes reflected in key handling and help/status display. Active key bindings are grouped by their current scope, and overridden bindings are shown with strikethrough, making it easier to understand which shortcuts are available in nested operations. [#​625](idursun/jjui#625) <img width="1508" height="397" alt="Scoped status/help display" src="https://github.com/user-attachments/assets/c3d1ec20-10db-4213-a683-69c9b162aec0" /> #### Improvements ##### Inline describe customisation Inline describe is now easier to customise from bindings and Lua. You can bind `revisions.inline_describe.new_line` separately from `revisions.inline_describe.accept`, and `accept` can take `force = true` for workflows that intentionally update immutable revisions. [#​260](idursun/jjui#260) ```toml [[bindings]] action = "revisions.inline_describe.accept" key = "enter" scope = "revisions.inline_describe" [[bindings]] action = "revisions.inline_describe.new_line" key = "shift+enter" scope = "revisions.inline_describe" ``` - jjui now refreshes only once on startup instead of doing duplicate initial refresh work. - Git operation screens now close when the underlying command starts executing, making the transition from choosing an action to running it clearer. - Debug logging now uses `JJUI_DEBUG` instead of the generic `DEBUG` environment variable, reducing the chance that unrelated shell configuration accidentally enables jjui debug behaviour. #### Fixes - Fixed paste handling in Bubble Tea v2 text-input flows, including pasting into the bookmark filter input. [#​601](idursun/jjui#601), [#​597](idursun/jjui#597) - Fixed rebase source plus insert-between so jjui generates the correct `jj rebase -s <source> --insert-before <rev> --insert-after <rev>` command. [#​598](idursun/jjui#598) - Fixed diff rendering for tab-indented lines. The diff view now preserves indentation and handles wrapping and horizontal scrolling correctly for tab-expanded content. [#​606](idursun/jjui#606), [#​604](idursun/jjui#604) - Fixed command history rendering so long histories are not clipped at the top border, including exact-fit cases. Flash and command-history overlays also layer more cleanly above the status area. [#​626](idursun/jjui#626), [#​622](idursun/jjui#622) - Fixed fuzzy file overlay ordering so the fuzzy file UI appears in the correct layer. - Fixed clipped rendering for partially visible list items and fallback messages while horizontally scrolled. - Fixed revset alias parameter metadata preservation. #### What's Changed - Handle Bubble Tea paste messages in text-input flows by [@​shardulbee](https://github.com/shardulbee) in [#​601](idursun/jjui#601) - Set preview subprocess size via env by [@​OliverJAsh](https://github.com/OliverJAsh) in [#​608](idursun/jjui#608) - add repo config file which overrides global config.toml by [@​nickchomey](https://github.com/nickchomey) in [#​609](idursun/jjui#609) - fix(diff): preserve tab indentation in diff view by [@​baggiiiie](https://github.com/baggiiiie) in [#​606](idursun/jjui#606) - Update installation instruction for archlinux by [@​TeddyHuang-00](https://github.com/TeddyHuang-00) in [#​613](idursun/jjui#613) - refactor: replace owner-based dispatch with scope-layer routing by [@​idursun](https://github.com/idursun) in [#​625](idursun/jjui#625) - fix: command history clipping by [@​idursun](https://github.com/idursun) in [#​626](idursun/jjui#626) - fix(set\_parents): leak set\_parents operation key scope by [@​baggiiiie](https://github.com/baggiiiie) in [#​628](idursun/jjui#628) - fix(details): sync details selection for routed intents by [@​baggiiiie](https://github.com/baggiiiie) in [#​627](idursun/jjui#627) - fix: add back esc to clear selected revisions by [@​baggiiiie](https://github.com/baggiiiie) in [#​629](idursun/jjui#629) - fix(revisions): avoid toggle-select panic on empty revisions by [@​baggiiiie](https://github.com/baggiiiie) in [#​636](idursun/jjui#636) - feat(lua): install Lua meta types by [@​idursun](https://github.com/idursun) in [#​617](idursun/jjui#617) #### New Contributors - [@​shardulbee](https://github.com/shardulbee) made their first contribution in [#​601](idursun/jjui#601) - [@​OliverJAsh](https://github.com/OliverJAsh) made their first contribution in [#​608](idursun/jjui#608) **Full Changelog**: <idursun/jjui@v0.10.2...v0.10.3> </details> --- ### Configuration 📅 **Schedule**: (UTC) - 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:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjcuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEyNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
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.
Bug:
Pressing the revisions toggle-select action could panic with
"noindex out of range [0] with length 0" when the revisions list was empty.
The handler indexed m.rows[m.cursor] directly even when there was no selected row.
How to reproduce:
Fix:
Use SelectedRevision() instead of indexing m.rows directly. That centralizes the
bounds check and returns nil when no revision is selected, so toggle-select
becomes a safe no-op for the empty-list case. Add a regression test to lock in
that behavior.