Invert the logic for Mouse Tracking events
ClosedPublic

Authored by ahmadsamir on May 26 2018, 9:10 AM.

Details

Summary

Previously the logic was to set "usesMouse" (Emulation
MODE_Mouse100{0,1,2,3}) to false to indicate that the program running
in the terminal supports handling mouse events itself, i.e. the program
is interested in receiving Mouse Tracking events; or set to true otherwise.

Since this was confusing, use the inverse logic by replacing "usesMouse"
with "usesMouseTracking".

"usesMouseTracking" is set to true when the program running in the shell
indicates it's interested in receiving Mouse Tracking events. Or false
otherwise.

For example, vim indicates it's interested in receiving Mouse Tracking
evnets when using visual mouse mode:
http://vimdoc.sourceforge.net/htmldoc/intro.html#Normal

Mouse Tracking is an XTerm extension, for more information examine:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking

Test Plan

Before:

  • Execute printf '\e[?1003h' to enable mouse tracking mode in konsole, now when you move the mouse events will be sent to the terminal when you move, click, drag the mouse
  • Pressing and holding the Shift key should let the mouse act as normal
  • Open a new tab or execute printf 'e[?1003l', then open any file in vim, :set mouse=a then select some text with the mouse, note that VISUAL is displayed at the bottom of the window; right clicking _doesn't_ show the context menu as you'd expecte
  • Pressing and holding the Shift key should let the mouse act as normal

Apply the diff, build, and try again, everything should work as before.

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.May 26 2018, 9:10 AM
Restricted Application added a project: Konsole. · View Herald TranscriptMay 26 2018, 9:10 AM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
ahmadsamir requested review of this revision.May 26 2018, 9:10 AM
ahmadsamir retitled this revision from Use the reverse logic for Mouse Tracking events to Invert the logic for Mouse Tracking events.
ahmadsamir edited the summary of this revision. (Show Details)

Tweak the commit message (i.e. correct grammatical mistakes)

ahmadsamir edited the summary of this revision. (Show Details)

Tweak the commit message some more

ahmadsamir edited the test plan for this revision. (Show Details)

Clarify steps in the Test Plan

Thanks, the only issue I see is that shouldn't the two constructor initialization be swamped for true? _usesMouseTracking(false), _usesMouseTracking(false),

Thanks, the only issue I see is that shouldn't the two constructor initialization be swamped for true? _usesMouseTracking(false), _usesMouseTracking(false),

I think both of them should be false, because Mouse Tracking events should only be sent if the program running in the terminal indicates it's interested in such events. For example:

  • Using the normal/primary screen buffer, bash isn't interested in those events
  • less, which uses the secondary screen buffer, doen't have support for such events at all
  • vim, should ideally want those events in mouse visual mode, but not otherwise
hindenburg accepted this revision.May 28 2018, 1:27 PM
This revision is now accepted and ready to land.May 28 2018, 1:27 PM
This revision was automatically updated to reflect the committed changes.