From 840723de3b725ea8f42bf6f3302acc6a2be640fa Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Thu, 8 Oct 2026 17:49:53 +0200 Subject: [PATCH] gui: fix coordinate mapping for prompt textarea double-click The MouseArea (chordArea) is a sibling of the ScrollView containing promptInput, so mouse.x/y are relative to the parent Item, not the TextArea. Map coordinates via mapToItem before calling positionAt. --- kde/CMakeLists.txt | 2 ++ kde/gui/ChatPane.qml | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kde/CMakeLists.txt b/kde/CMakeLists.txt index 22cba01..b702f19 100644 --- a/kde/CMakeLists.txt +++ b/kde/CMakeLists.txt @@ -151,6 +151,8 @@ qt_add_resources(ollie-gui "gui" gui/ChatBlockDelegate.qml gui/SessionTree.qml gui/ChatPane.qml + gui/TextSelection.js + gui/ollie.svg ) # --- Install --- diff --git a/kde/gui/ChatPane.qml b/kde/gui/ChatPane.qml index f2df0f8..cb9a0fa 100644 --- a/kde/gui/ChatPane.qml +++ b/kde/gui/ChatPane.qml @@ -488,8 +488,10 @@ Item { onDoubleClicked: function(mouse) { if (mouse.button === Qt.LeftButton) { - if (!TextSelection.selectBracketPair(promptInput, mouse.x, mouse.y)) { - TextSelection.selectWordAt(promptInput, mouse.x, mouse.y) + // Map coordinates from chordArea to promptInput + var mappedPos = chordArea.mapToItem(promptInput, mouse.x, mouse.y) + if (!TextSelection.selectBracketPair(promptInput, mappedPos.x, mappedPos.y)) { + TextSelection.selectWordAt(promptInput, mappedPos.x, mappedPos.y) } mouse.accepted = true } @@ -543,7 +545,8 @@ Item { if (sel && sel.trim() !== "") { plumber.plumb(sel.trim(), sessionCwd()) } else { - var pos = promptInput.positionAt(mouse.x, mouse.y) + var mappedPos = chordArea.mapToItem(promptInput, mouse.x, mouse.y) + var pos = promptInput.positionAt(mappedPos.x, mappedPos.y) var word = wordAtCursor(promptInput, pos) if (word) plumber.plumb(word, sessionCwd()) }