Skip to content

ui,preview: fix preview pane ctrl-u/d scrolling#472

Merged
idursun merged 1 commit intoidursun:mainfrom
baggiiiie:yc/fix-preview-srcolling
Jan 15, 2026
Merged

ui,preview: fix preview pane ctrl-u/d scrolling#472
idursun merged 1 commit intoidursun:mainfrom
baggiiiie:yc/fix-preview-srcolling

Conversation

@baggiiiie
Copy link
Copy Markdown
Collaborator

@baggiiiie baggiiiie commented Jan 15, 2026

Commit 8481b92 broke ctrl-u/d scrolling in the preview pane, see below
code:

if common.IsInputMessage(msg) {
    if m.oplog != nil {
        cmds = append(cmds, m.oplog.Update(msg))
    } else {
        cmds = append(cmds, m.revisions.Update(msg))
    }
    return tea.Batch(cmds...)
}

This causes unhandled key messages to be routed only to oplog or
revisions, and then returns early, so they never reach the preview
model's Update() call which happens later in the function.

This fix groups preview related commands and make sure they are always
handled.

Also, added a YOffset() method to internal/ui/preview/preview.go to expose
the viewport's Y offset for testing purposes.

@baggiiiie baggiiiie requested a review from idursun as a code owner January 15, 2026 15:34
Commit 8481b92 broke ctrl-u/d scrolling in the preview pane, see below
code:
```
if common.IsInputMessage(msg) {
    if m.oplog != nil {
        cmds = append(cmds, m.oplog.Update(msg))
    } else {
        cmds = append(cmds, m.revisions.Update(msg))
    }
    return tea.Batch(cmds...)
}
```
This causes unhandled key messages to be routed only to oplog or
revisions, and then returns early, so they never reach the preview
model's Update() call which happens later in the function.


This fix groups preview related commands and make sure they are always
handled.

Also, added a YOffset() method to internal/ui/preview/preview.go to
expose the viewport's Y offset for testing purposes.
@baggiiiie baggiiiie force-pushed the yc/fix-preview-srcolling branch from 349c89e to 7b94ee0 Compare January 15, 2026 15:49
Copy link
Copy Markdown
Owner

@idursun idursun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I was almost sure that change was going to break something but couldn't find anything myself.

@idursun idursun merged commit e6dd7df into idursun:main Jan 15, 2026
4 checks passed
idursun added a commit that referenced this pull request Jan 15, 2026
@baggiiiie baggiiiie deleted the yc/fix-preview-srcolling branch January 16, 2026 00:20
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 18, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [idursun/jjui](https://github.com/idursun/jjui) | patch | `v0.9.9` → `v0.9.10` |

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.10`](https://github.com/idursun/jjui/releases/tag/v0.9.10)

[Compare Source](idursun/jjui@v0.9.9...v0.9.10)

### Release Notes

#### 🆕 Features

##### Lua Scripting Enhancements

- **Lua Context Module** ([#&#8203;465](idursun/jjui#465)): Added context module to Lua scripting API, exposing methods for accessing selected item metadata and checked items:
  - `context.change_id()` - Get the change ID of selected revision or file
  - `context.commit_id()` - Get the commit ID of selected revision, file, or commit
  - `context.file()` - Get the file path of selected file
  - `context.operation_id()` - Get the operation ID of selected operation
  - `context.checked_files()` - Get array of checked file paths
  - `context.checked_change_ids()` - Get array of change IDs from checked items
  - `context.checked_commit_ids()` - Get array of commit IDs from checked items
- **Shell Execution in Lua** ([#&#8203;471](idursun/jjui#471)): Exposed `exec_shell()` function to Lua scripts, enabling interactive commands like opening files in external editors directly from jjui. This enables custom commands such as:
  ```toml
  [custom_commands.open_file]
  key = ["O"]
  lua = '''
  local file = context.file()
  if not file then
      flash("No file selected")
      return
  end
  exec_shell("vim " .. file)
  '''
  ```

#### ✨ Improvements

- **Abandon Workflow**: Removed confirmation dialog; users can now use Space to add/remove revisions from the abandon list

#### 🐛 Bug Fixes

- **Preview Pane Scrolling** ([#&#8203;472](idursun/jjui#472)): Fixed broken Ctrl-U/Ctrl-D scrolling in the preview pane that was introduced by earlier input routing changes. Preview commands are now properly grouped and always handled.
- **Parser**: Fixed handling of divergent change ID format
- **Bookmarks**: Fixed tracking of new bookmarks (currently tracks all remotes)

#### 🔧 Compatibility

- **Jujutsu 0.36.0 Support** ([#&#8203;407](idursun/jjui#407)): Updated commands to work with breaking changes in Jujutsu 0.36.0:
  - Changed `--destination` flag to `--onto`
  - Changed `--edit` flag to `--editor`
  - Removed deprecated `--allow-new` flag from `git push` commands
  - Updated keybinding from `d` to `o` for `--onto` flag in related modes

#### 📝 Documentation

- **README Updates** ([#&#8203;470](idursun/jjui#470)):
  - Added missing op log revert item to help menu
  - Fixed redo documentation
  - Updated custom command examples

#### What's Changed

- jj-update: fix commands to work with breaking changes in jj-0.36.0 by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;407](idursun/jjui#407)
- refactor(abandon): remove confirmation dialog by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;462](idursun/jjui#462)
- fix(bookmarks): track new bookmarks by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;463](idursun/jjui#463)
- feat(lua): add context module by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;465](idursun/jjui#465)
- lua: expose exec\_shell to lua script by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;471](idursun/jjui#471)
- README improvements and help menu missing item by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;470](idursun/jjui#470)
- ui,preview: fix preview pane ctrl-u/d scrolling by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;472](idursun/jjui#472)

**Full Changelog**: <idursun/jjui@v0.9.9...v0.9.10>

</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:eyJjcmVhdGVkSW5WZXIiOiI0Mi44NC4wIiwidXBkYXRlZEluVmVyIjoiNDIuODQuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants