Revert "gui: remove cut/copy/paste from prompt input"

This reverts commit eb09a95a64.
This commit is contained in:
Levi Neely 2026-10-07 17:35:10 +02:00
parent eb09a95a64
commit ab4f0ef785
1 changed files with 71 additions and 2 deletions

View File

@ -406,7 +406,7 @@ Item {
if (!ollie.activeSessionId) return "No session" if (!ollie.activeSessionId) return "No session"
if (!ollie.activeAgentId) return "No agent" if (!ollie.activeAgentId) return "No agent"
if (ollie.activeSessionPaused) return "Session paused" if (ollie.activeSessionPaused) return "Session paused"
return "B1=sel B2=exec B3=plumb" return "B1=sel B2=exec B3=plumb B1+B2=cut B1+B3=paste"
} }
enabled: ollie.daemonConnected && ollie.activeSessionId !== "" && ollie.activeAgentId !== "" && !ollie.activeSessionPaused enabled: ollie.daemonConnected && ollie.activeSessionId !== "" && ollie.activeAgentId !== "" && !ollie.activeSessionPaused
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
@ -432,10 +432,12 @@ Item {
} }
} }
// Acme-style mouse handling overlay // Acme-style mouse chording overlay
// B1 = select (handled by TextArea) // B1 = select (handled by TextArea)
// B2 = execute selection // B2 = execute selection
// B3 = plumb selection / context menu // B3 = plumb selection / context menu
// B1+B2 = cut (snarf)
// B1+B3 = paste
MouseArea { MouseArea {
id: chordArea id: chordArea
anchors.fill: parent anchors.fill: parent
@ -443,12 +445,46 @@ Item {
propagateComposedEvents: true propagateComposedEvents: true
cursorShape: Qt.IBeamCursor cursorShape: Qt.IBeamCursor
// Track if B1 (left) is currently held for chord detection
property bool leftHeld: false
// We can't directly detect B1 here since TextArea handles it,
// but we can check mouse.buttons in the handlers
onPressed: function(mouse) {
// Check if this is a chord (B1 already held)
if (mouse.buttons & Qt.LeftButton) {
leftHeld = true
if (mouse.button === Qt.MiddleButton) {
// B1+B2 = cut
promptInput.cut()
mouse.accepted = true
return
} else if (mouse.button === Qt.RightButton) {
// B1+B3 = paste
promptInput.paste()
mouse.accepted = true
return
}
}
leftHeld = false
mouse.accepted = false // Let it propagate for non-chord
}
onClicked: function(mouse) { onClicked: function(mouse) {
// Only handle non-chord clicks
if (leftHeld) {
leftHeld = false
return
}
if (mouse.button === Qt.MiddleButton) { if (mouse.button === Qt.MiddleButton) {
// B2: Execute selection as prompt // B2: Execute selection as prompt
var sel = promptInput.selectedText var sel = promptInput.selectedText
if (sel && sel.trim() !== "") { if (sel && sel.trim() !== "") {
ollie.submit(sel.trim()) ollie.submit(sel.trim())
} else {
// No selection - paste from clipboard and execute?
// Or just ignore. For now, ignore.
} }
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
// B3: Plumb selection or show context menu // B3: Plumb selection or show context menu
@ -460,6 +496,10 @@ Item {
} }
} }
} }
onReleased: {
leftHeld = false
}
} }
Menu { Menu {
@ -481,6 +521,22 @@ Item {
} }
} }
MenuSeparator {} MenuSeparator {}
MenuItem {
text: "Cut (B1+B2)"
enabled: promptInput.selectedText.length > 0
onTriggered: promptInput.cut()
}
MenuItem {
text: "Copy"
enabled: promptInput.selectedText.length > 0
onTriggered: promptInput.copy()
}
MenuItem {
text: "Paste (B1+B3)"
enabled: promptInput.canPaste
onTriggered: promptInput.paste()
}
MenuSeparator {}
MenuItem { MenuItem {
text: "Select All" text: "Select All"
onTriggered: promptInput.selectAll() onTriggered: promptInput.selectAll()
@ -488,6 +544,19 @@ Item {
} }
} }
// Paste button (mouse-first workflow)
ToolButton {
text: "📋"
font.pixelSize: 14
implicitWidth: 36
implicitHeight: 36
Layout.alignment: Qt.AlignBottom
enabled: promptInput.enabled
onClicked: promptInput.paste()
ToolTip.visible: hovered
ToolTip.text: "Paste from clipboard"
}
// Send button (larger touch target) // Send button (larger touch target)
Button { Button {
text: "▶" text: "▶"