Skip to content

fix: correctly handle enableMouseMovement default value - #453

Merged
kommander merged 2 commits into
anomalyco:mainfrom
aarongrtech:fix/enable-mouse-movement-default
Dec 30, 2025
Merged

fix: correctly handle enableMouseMovement default value#453
kommander merged 2 commits into
anomalyco:mainfrom
aarongrtech:fix/enable-mouse-movement-default

Conversation

@aarongrtech

Copy link
Copy Markdown
Contributor

Summary

  • Fixed bug where useMouse: false was being ignored due to incorrect use of || operator

Problem

In renderer.ts line 513, the code used:

this.enableMouseMovement = config.enableMouseMovement || true

This always evaluates to true because:

  • true || true = true
  • false || true = true
  • undefined || true = true

Solution

Changed to nullish coalescing operator:

this.enableMouseMovement = config.enableMouseMovement ?? true

This correctly handles explicit false:

  • true ?? true = true
  • false ?? true = false ← explicit false is now respected!
  • undefined ?? true = true (default)

Testing

Added unit test at packages/core/src/tests/renderer.useMouse.test.ts that verifies:

  1. useMouse: true enables mouse tracking
  2. useMouse: false disables mouse tracking (NO mouse sequences sent)
  3. Toggling useMouse property updates renderer state correctly

All tests pass.

Related

This fix enables the disable_mouse feature in OpenCode (PR anomalyco/opencode#6329) to work correctly, allowing Linux users with right-click paste terminals (Terminator, PuTTY-style) to use native paste behavior.

The enableMouseMovement config option was using || instead of ?? which
caused it to always be true regardless of the config value passed.

This fix ensures useMouse: false works correctly by using nullish
coalescing (??) so that explicit false values are respected.

Also adds tests for useMouse configuration behavior.
@kommander
kommander merged commit 4735f6e into anomalyco:main Dec 30, 2025
4 checks passed
@aarongrtech
aarongrtech deleted the fix/enable-mouse-movement-default branch December 30, 2025 13:40
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