Add middle-button scrolling support - #20469
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
@microsoft-github-policy-service agree |
|
Mind sharing a video? |
Screen.Recording.2026-07-27.111029.mp4@DHowett sure, here it is |
| X(hstring, DragDropDelimiter, "dragDropDelimiter", L" ") \ | ||
| X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None) | ||
| X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None) \ | ||
| X(Microsoft::Terminal::Control::MiddleClickAction, MiddleClickAction, "middleClickAction", Microsoft::Terminal::Control::MiddleClickAction::Default) |
There was a problem hiding this comment.
The PR looks good overall, but this should technically be an action / keybinding. Since we don't have proper mouse-bindings yet, could we just mark this setting as experimental like some others?
There was a problem hiding this comment.
Thanks for the review @lhecker! That makes total sense. I've updated the setting JSON key to "experimental.middleClickAction" in MTSMSettings.h.
| JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Control::MiddleClickAction) | ||
| { | ||
| static constexpr std::array<pair_type, 4> mappings = { | ||
| pair_type{ "default", ValueType::Default }, |
There was a problem hiding this comment.
I don't think we need a default value, right? The default is unambiguously scrolling, at least on Windows.
There was a problem hiding this comment.
I've removed the redundant "default" string option and made Pan (0) the default enum value for experimental.middleClickAction so the JSON options are cleanly "pan", "paste", and "none".
eb8966a to
7ce3da4
Compare
|
Hi @DHowett ! Sorry for the confusion. Both @SanjayPJ and @ghnew are my GitHub accounts. I accidentally used different accounts for the contribution and the CLA. To keep everything consistent, I've now rewritten the commit author so that all commits are attributed to @ghnew, which is the account associated with the CLA. Please let me know if there's anything else I need to do. |
|
Do note that GitHub's TOS technically forbids having multiple non-paid accounts. |
Summary of the Pull Request
Introduces Mouse Panning (middle-button scrolling) and a configurable
middleClickActionsetting to Windows Terminal (wt.exe).Users can now middle-click to enter vertical autoscroll panning mode with dynamic cursor icon feedback ($\updownarrow$ while moving), or configure middle-click to paste text (common in Unix/Linux terminals).
SizeAll╬ at the origin anchor andSizeNorthSouthReferences and Relevant Issues
Detailed Description of the Pull Request / Additional comments
Settings Model (
src/cascadia/TerminalSettingsModel/&src/cascadia/inc/):MiddleClickActionenum (Default = 0,Pan,Paste,None) andMiddleClickActionproperty toIControlSettings.idl.CONTROL_SETTINGS(X)inControlProperties.h.middleClickActionin profile settings (Profile.idl,MTSMSettings.h).TerminalSettingsSerializationHelpers.handEnumMappings.cppto support"pan","paste","default", and"none"values insettings.json.Input Interactivity & Viewport Control (
src/cascadia/TerminalControl/):ControlInteractivity.cpp: UpdatedPointerPressedforIsMiddleButtonDownto evaluateMiddleClickAction. When set toPaste, it raisesRequestPasteTextFromClipboard().TermControl.cpp:_isPanningand_panningAnchorPosstate tracking in_PointerPressedHandler,_PointerMovedHandler, and_PointerReleasedHandler._TryStartAutoScroll(...).CoreWindow::GetForCurrentThread().PointerCursor(...)toCoreCursorType::SizeAll╬ when stationary near the anchor point andCoreCursorType::SizeNorthSouthIBeamwhen panning completes.Unit Testing (
src/cascadia/UnitTests_Control/):TestMiddleClicktoControlInteractivityTests.cppto test settings evaluation and clipboard paste event dispatching.Validation Steps Performed
te.exeonControl.Unit.Tests.dll. VerifiedTestMiddleClickpassed (1/1 Passed).WindowsTerminal.exelocally.SizeAllSizeNorthSouth)."middleClickAction": "paste"tosettings.jsonand verified middle-clicking pastes clipboard text.vim/tmux) when VT mouse tracking is active.PR Checklist