fix(editor): preserve multi-click selection drags

This commit is contained in:
Eve authored and GitHub committed 2026-09-10 14:30:23 +08:00
1 parent b37f63e716
commit a688aadec2
4 files changed
+20 -19

No files matched your search

@@ -137,7 +137,7 @@ import { sqlBlockFoldService } from "@/lib/editor/codemirrorSqlBlockFolding";
import { focusEditorView } from "@/lib/editor/queryEditorFocus";
import { createDbxCodeMirrorSqlDialect, type CodeMirrorSqlDialectName } from "@/lib/editor/codemirrorSqlDialect";
import { sqlSemanticTableNameSpansForSyntaxTree } from "@/lib/editor/codemirrorSqlSemanticHighlight";
import { startsQueryEditorRectangularSelection, usesQueryEditorObjectNavigationModifier } from "@/lib/editor/queryEditorPointerSelection";
import { startsQueryEditorRectangularSelection, startsQueryEditorSelectionDrag, usesQueryEditorObjectNavigationModifier } from "@/lib/editor/queryEditorPointerSelection";
import { LARGE_PASTE_HISTORY_USER_EVENT, normalizeQueryEditorPasteText, recoverableNativePasteSuffix, shouldRecoverLargeTauriPaste } from "@/lib/editor/queryEditorLargePaste";
import { computePasteCaretResyncTarget } from "@/lib/editor/queryEditorPasteCaretResync";
import { queryEditorCommentTokens, queryEditorLineCommentToken, queryEditorWordLanguageData } from "@/lib/editor/queryEditorLineComment";
@@ -1417,10 +1417,7 @@ function updateEditorSelectionDropCursor(currentView: EditorViewType, event: Mou
}
function startEditorSelectionDrag(currentView: EditorViewType, event: MouseEvent): boolean {
// Shift is CodeMirror's native extend-selection gesture. Keep it out of the
// custom selection drag path so a shift-click inside the current selection
// extends or shrinks the selection instead of collapsing it to the cursor.
if (event.shiftKey) return false;
if (!startsQueryEditorSelectionDrag(event)) return false;
const selection = selectedRangeAtPointer(currentView, event);
if (!selection) return false;