Chord: arm anchor on left double-click so dblclick -> chord flows
A double-click's second press arrives as MouseButtonDblClick, not a plain press, so m_leftDownInView was never set and the still-held button could not anchor a chord. Set the chord anchor on a left double-click inside the view (bracket- or word-select), letting the user proceed directly from a double-click into a left+middle (Cut) or left+right (Paste) chord without releasing. All 5 ctest suites green.
This commit is contained in:
parent
a804dbe521
commit
5439d43ac4
|
|
@ -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`,
|
||||
|
|
|
|||
|
|
@ -494,18 +494,24 @@ 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<QMouseEvent *>(event);
|
||||
if (mev->button() == Qt::LeftButton) {
|
||||
KTextEditor::View *v = m_mainWindow->activeView();
|
||||
auto *w = qobject_cast<QWidget *>(obj);
|
||||
if (v && w && v->isAncestorOf(w)
|
||||
&& selectBracketPairAt(v, mev->globalPosition().toPoint())) {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// While a drag gesture is active, drive the radial directly from the raw
|
||||
// events: the opening press leaves an implicit grab on the editor view, so
|
||||
|
|
|
|||
Loading…
Reference in New Issue