From 3cdf864076fad308bfb7aa58e19c3cbcee8bbe0b Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 29 Apr 2026 15:01:43 -0700 Subject: [PATCH] Fix rounding error for word selection (#20084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary of the Pull Request Dustin reported this bug to me. Thankfully it was an easy fix. ## References and Relevant Issues Bug from implementing #5099 ## Validation Steps Performed Double-click ____ of right-most cell of a word selects the current word ✅ right-half ✅ left-half (cherry picked from commit 115ec2cbb990f56b553a1c1dcc8de96e86d4f8f9) Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgraAYs Service-Version: 1.24 --- src/cascadia/TerminalControl/ControlInteractivity.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalControl/ControlInteractivity.cpp b/src/cascadia/TerminalControl/ControlInteractivity.cpp index 37e4bae5e5..e4522bc861 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.cpp +++ b/src/cascadia/TerminalControl/ControlInteractivity.cpp @@ -301,8 +301,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation const auto isOnOriginalPosition = _lastMouseClickPosNoSelection == pixelPosition; // Rounded coordinates for text selection. - // Don't round in VT mouse mode; cell-level precision matters more - const auto round = !_core->IsVtMouseModeEnabled(); + // Don't round in VT mouse mode; cell-level precision matters more. + // Only round for single-click: for double/triple-click, rounding + // can push the position to the next cell, selecting the wrong word. + const auto round = multiClickMapper == 1 && !_core->IsVtMouseModeEnabled(); _core->LeftClickOnTerminal(_getTerminalPosition(til::point{ pixelPosition }, round), multiClickMapper, altEnabled,