Fix SGR and PIXEL mouse modes blocked by mouse_event check#5
Merged
kdj0c merged 1 commit intokmscon:mainfrom Dec 17, 2025
Merged
Fix SGR and PIXEL mouse modes blocked by mouse_event check#5kdj0c merged 1 commit intokmscon:mainfrom
kdj0c merged 1 commit intokmscon:mainfrom
Conversation
The SGR (mode 1006) and PIXEL (mode 1016) mouse mode handlers were incorrectly checking the vte->mouse_event flag, which prevented these modes from working when mouse_event was 0. This bug affected applications like less and vim that activate SGR mouse mode without setting a specific mouse_event value. The condition "&& vte->mouse_event" was preventing the mode handlers from executing even when the mouse mode was correctly set to SGR or PIXEL. The mouse_event flag is used to filter which types of events to report (button press/release, motion, etc.), but it should not prevent the mode handler from executing when the mode is active. The mode check alone (vte->mouse_mode == TSM_VTE_MOUSE_MODE_SGR) is sufficient. Test case: - Run 'less --mouse' in kmscon - Before fix: mouse wheel does not work - After fix: mouse wheel works correctly - Same behavior applies to vim with 'set ttymouse=sgr'
Contributor
|
It looks good to me, if no other comment, I'll merge it soon. |
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.
Pull Request: Fix SGR and PIXEL mouse modes blocked by mouse_event check
Summary
This PR fixes a bug where SGR (mode 1006) and PIXEL (mode 1016) mouse modes were not working in applications like
lessandvimdue to an incorrect condition check.The Bug
In
src/tsm/tsm-vte.c, the SGR and PIXEL mode handlers check both the mouse mode AND the mouse_event flag:Problem: When applications like
lessorvimactivate SGR mouse mode, they don't always setvte->mouse_eventfirst. The value remains 0, causing the condition&& vte->mouse_eventto evaluate to false, and the SGR/PIXEL handler never executes.The Fix
Remove the
&& vte->mouse_eventcondition from both checks:Rationale: The
mouse_modecheck alone is sufficient. If the mode is set to SGR or PIXEL, the handler should execute. Themouse_eventflag is used internally to filter event types (press/release/motion), but shouldn't prevent the mode handler from running.Test Cases
Before the fix:
less --mousein kmscon → mouse wheel does NOT workvimwith:set mouse=a ttymouse=sgr→ mouse wheel does NOT work (in some cases)After the fix:
less --mousein kmscon → mouse wheel WORKS correctlyvimwith:set mouse=a ttymouse=sgr→ mouse wheel WORKS correctlyImpact
This bug affects any application using libtsm that:
less,vim,emacs,nanowith mouse supportRelated Information
Compatibility
This change has no negative impact: