Skip to content

fix(tui): mouse click on list item does not update detail pane#1331

Merged
SorraTheOrc merged 2 commits intomainfrom
copilot/fix-tui-work-item-selection
Apr 2, 2026
Merged

fix(tui): mouse click on list item does not update detail pane#1331
SorraTheOrc merged 2 commits intomainfrom
copilot/fix-tui-work-item-selection

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Mouse-click selection in the TUI work-item list visually moved the highlight but left the detail pane showing the previously selected item. Arrow-key navigation was unaffected.

Root cause

In blessed, clicking a different list item routes through the internal item.on('click') handler which calls self.select(item)List.prototype.select(). That method emits 'select item', not 'select':

// blessed/lib/widgets/list.js – List.prototype.select
this.emit('select item', this.items[this.selected], this.selected);
// 'select' is only emitted on Enter or when clicking the already-selected item

The controller listened to 'select' (Enter/re-click) and 'keypress' (arrows), with no handler for 'select item'. The screen.on('mouse') fallback was also unreliable because it requires list.lpos to be populated.

Changes

  • src/tui/controller.ts — adds listSelectItemHandler subscribed to list.on('select item', ...). This event fires via List.prototype.select() for every selection change—keyboard, mouse, and programmatic—making it the canonical place to refresh the detail pane. Reference stored as __opencode_select_item following the existing __opencode_select / __opencode_keypress pattern.

  • tests/tui/tui-mouse-select.test.ts — regression tests covering:

    • detail pane updates when 'select item' fires for a newly clicked item
    • scroll position is preserved when re-selecting the currently selected item
    • __opencode_select_item handler is registered on startup

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh issue create --repo TheWizardsCode/ContextHub --title Sample --body-file - (http block)
    • Triggering command: /usr/bin/gh gh issue create --repo TheWizardsCode/ContextHub --title Sample --body-file - bash (http block)

If you need me to access, download, or install something from one of these locations, you can either:

When clicking a different list item, blessed fires 'select item' (not
'select') via List.prototype.select(). Add listSelectItemHandler that
listens to 'select item' so the detail pane updates on mouse click.

Store reference as __opencode_select_item matching existing pattern.
Add regression tests in tests/tui/tui-mouse-select.test.ts.

Agent-Logs-Url: https://github.com/TheWizardsCode/ContextHub/sessions/fe8e523d-6dab-4ac1-a60e-31154b42d85f

Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix mouse selection of work item in TUI fix(tui): mouse click on list item does not update detail pane Apr 2, 2026
Copilot AI requested a review from SorraTheOrc April 2, 2026 00:46
@SorraTheOrc
Copy link
Copy Markdown
Member

This automated review is currently blocked and this PR is not ready to merge until review checks can run.

  • Tests: not executed (Ampa review container failed to start).
  • Audit: not executed (blocked before checkout).
  • Code Review: not executed (blocked before checkout).

Critical/Blocking issues

  • Review infrastructure failure: wl ampa start-work crashed with a ReferenceError in the Ampa plugin, preventing container provisioning for PR checkout and checks.

Non-blocking issues

  • None identified in this run.

@SorraTheOrc
Copy link
Copy Markdown
Member

Automated review is currently blocked before merge-readiness checks can run.

  • Canonical Worklog link resolved to (from linked issue Selecting work item in TUI using mouse does not update displayed conttent. #1330).
  • Containerized review setup failed: Creating sandbox container to work on WL-0MNI39M81006L7NX...
    Syncing worklog data...
    Work item "WL-0MNI39M81006L7NX" already has container "ampa-pool-0". Entering...
    Syncing worklog data... raised in the Ampa plugin.
  • Tests, audit, and code-review were not executed in an isolated review container.

A blocker work item has been opened to restore Ampa container startup so this review can be rerun: .

@SorraTheOrc
Copy link
Copy Markdown
Member

Review update: automated checks are still blocked before merge-readiness validation can run.

Please resolve WL-0MNI3D00000917G0, then rerun automated PR review for #1331.

@SorraTheOrc SorraTheOrc marked this pull request as ready for review April 2, 2026 23:17
@SorraTheOrc SorraTheOrc merged commit 61f3abf into main Apr 2, 2026
4 checks passed
@SorraTheOrc SorraTheOrc deleted the copilot/fix-tui-work-item-selection branch April 2, 2026 23:21
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.

Selecting work item in TUI using mouse does not update displayed conttent.

2 participants