gui: B3 plumbs without selecting; _ included in word chars

B3 (right-click) on a word now plumbs it directly without visually
selecting it first. Double-click word selection includes underscores,
so snake_case selects the whole identifier.
This commit is contained in:
Levi Neely 2026-10-08 18:03:21 +02:00
parent 53a085f034
commit 445a5232c2
2 changed files with 5 additions and 7 deletions

View File

@ -248,7 +248,7 @@ Column {
if (sel && sel.trim() !== "") {
plumber.plumb(sel.trim(), sessionCwd())
} else {
selectAndPlumb(mainTextEdit, mouse.x, mouse.y)
plumbWordAt(mainTextEdit, mouse.x, mouse.y)
}
}
mouse.accepted = true
@ -359,13 +359,11 @@ Column {
return {start: start, end: end, word: text.substring(start, end)}
}
// Select word at cursor and plumb it (with visual highlight)
function selectAndPlumb(textEdit, mouseX, mouseY) {
// Plumb word at cursor (no selection)
function plumbWordAt(textEdit, mouseX, mouseY) {
var pos = textEdit.positionAt(mouseX, mouseY)
var result = wordAtCursor(textEdit, pos)
if (result) {
// Select the word to show what's being plumbed
textEdit.select(result.start, result.end)
plumber.plumb(result.word, sessionCwd())
}
}
@ -428,7 +426,7 @@ Column {
if (sel && sel.trim() !== "") {
plumber.plumb(sel.trim(), sessionCwd())
} else {
selectAndPlumb(textEdit, mouse.x, mouse.y)
plumbWordAt(textEdit, mouse.x, mouse.y)
}
}
mouse.accepted = true

View File

@ -154,7 +154,7 @@ function selectWordAt(textEdit, mouseX, mouseY) {
if (cursorPos < 0 || cursorPos > text.length) return
function isword(ch) {
return /[A-Za-z0-9]/.test(ch)
return /[A-Za-z0-9_]/.test(ch)
}
var start = cursorPos