Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(editor): keep shift-click selection in query editor

zipg97f5a37ba8d0
diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue
index 46a6f24512..001771fe0d 100644
--- a/apps/desktop/src/components/editor/QueryEditor.vue
+++ b/apps/desktop/src/components/editor/QueryEditor.vue
@@ -1337,6 +1337,11 @@ 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;
+
const selection = selectedRangeAtPointer(currentView, event);
if (!selection) return false;
diff --git a/apps/desktop/src/components/editor/__tests__/QueryEditorContextMenu.spec.ts b/apps/desktop/src/components/editor/__tests__/QueryEditorContextMenu.spec.ts
index 9419dd2987..14aafffc45 100644
--- a/apps/desktop/src/components/editor/__tests__/QueryEditorContextMenu.spec.ts
+++ b/apps/desktop/src/components/editor/__tests__/QueryEditorContextMenu.spec.ts
@@ -165,3 +165,16 @@ describe("QueryEditor batch column selection", () => {
expect(source).toContain("maxRenderedOptions: batchColumnSelectionExpandedRendering ? Number.MAX_SAFE_INTEGER : 100,");
});
});
+
+describe("QueryEditor pointer selection", () => {
+ it("lets CodeMirror handle shift-click instead of starting the selection drag gesture", () => {
+ const start = source.indexOf("function startEditorSelectionDrag");
+ const end = source.indexOf("\n}\n\nfunction executeFromContextMenu", start);
+ const dragSource = source.slice(start, end);
+
+ expect(start).toBeGreaterThanOrEqual(0);
+ expect(end).toBeGreaterThan(start);
+ expect(dragSource).toContain("if (event.shiftKey) return false;");
+ expect(dragSource.indexOf("if (event.shiftKey) return false;")).toBeLessThan(dragSource.indexOf("const selection = selectedRangeAtPointer"));
+ });
+});