diff --git a/docs/PLAN.md b/docs/PLAN.md index 5121e47..af4c7dc 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -150,6 +150,9 @@ Therefore the palette is replaced, not extended, and the replacement is built on (`characterAt`), scans with depth counting across line ends, and sets the selection. When no bracket is adjacent it falls through to Kate's default double-click (word select). +- A left double-click leaves the button held, so it also arms the chord anchor: + the user can go straight from a double-click (bracket- or word-select) into a + left+middle / left+right chord without releasing. ### M5 — Command vocabulary + project model + switchers — NEXT - `:`-verb pack via `KTextEditor::Command`: `sort`, `align`, `json`, `b64`, diff --git a/src/plugin/ollieplugin.cpp b/src/plugin/ollieplugin.cpp index a7d0775..8211d75 100644 --- a/src/plugin/ollieplugin.cpp +++ b/src/plugin/ollieplugin.cpp @@ -494,15 +494,21 @@ bool OllieView::eventFilter(QObject *obj, QEvent *event) { // Bracket-pair selection: double-clicking next to a bracket selects the // text between the matching pair (multi-line). Falls through to Kate's - // default double-click (word select) when no bracket is adjacent. + // default double-click (word select) when no bracket is adjacent. The + // second click of a double-click arrives as DblClick (not a plain press) + // and leaves the left button held, so it also arms the chord anchor — + // letting the user go straight from a double-click into a mouse chord. if (event->type() == QEvent::MouseButtonDblClick) { auto *mev = static_cast(event); if (mev->button() == Qt::LeftButton) { KTextEditor::View *v = m_mainWindow->activeView(); auto *w = qobject_cast(obj); - if (v && w && v->isAncestorOf(w) - && selectBracketPairAt(v, mev->globalPosition().toPoint())) { - return true; // handled: suppress default word-select + const bool inView = v && w && v->isAncestorOf(w); + if (inView) { + m_leftDownInView = true; // held after the dblclick: chord anchor + if (selectBracketPairAt(v, mev->globalPosition().toPoint())) { + return true; // handled: suppress default word-select + } } } }