From 115ec2cbb990f56b553a1c1dcc8de96e86d4f8f9 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 --- 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 06ce1e17f3..bd30911797 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.cpp +++ b/src/cascadia/TerminalControl/ControlInteractivity.cpp @@ -309,8 +309,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,