fix: correctly handle enableMouseMovement default value - #453
Merged
kommander merged 2 commits intoDec 30, 2025
Conversation
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.
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.
Summary
useMouse: falsewas being ignored due to incorrect use of||operatorProblem
In
renderer.tsline 513, the code used:This always evaluates to true because:
true || true=truefalse || true=trueundefined || true=trueSolution
Changed to nullish coalescing operator:
This correctly handles explicit
false:true ?? true=truefalse ?? true=false← explicit false is now respected!undefined ?? true=true(default)Testing
Added unit test at
packages/core/src/tests/renderer.useMouse.test.tsthat verifies:useMouse: trueenables mouse trackinguseMouse: falsedisables mouse tracking (NO mouse sequences sent)useMouseproperty updates renderer state correctlyAll tests pass.
Related
This fix enables the
disable_mousefeature 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.