diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue index 0a5ef7a22c..c63df89d3c 100644 --- a/apps/desktop/src/components/editor/QueryEditor.vue +++ b/apps/desktop/src/components/editor/QueryEditor.vue @@ -331,6 +331,22 @@ function selectAllSqlFromContextMenu() { focusEditor(); } +function selectSqlLineFromGutter( + currentView: EditorViewType, + line: { from: number; to: number }, + event: Event, +): boolean { + if (!(event instanceof MouseEvent) || event.button !== 0) return false; + event.preventDefault(); + currentView.dispatch({ + selection: { anchor: line.from, head: line.to }, + scrollIntoView: true, + userEvent: "select.pointer", + }); + currentView.focus(); + return true; +} + const contextMenuItems = computed(() => [ { label: executeContextMenuLabel.value, @@ -1324,7 +1340,11 @@ onMounted(async () => { return { dom }; }, }), - lineNumbers(), + lineNumbers({ + domEventHandlers: { + mousedown: selectSqlLineFromGutter, + }, + }), highlightActiveLineGutter(), highlightSpecialChars(), history(), diff --git a/apps/desktop/src/lib/editorThemes.ts b/apps/desktop/src/lib/editorThemes.ts index 0a36841ea9..b0358b57aa 100644 --- a/apps/desktop/src/lib/editorThemes.ts +++ b/apps/desktop/src/lib/editorThemes.ts @@ -143,6 +143,7 @@ export function buildEditorFontThemeRules( zIndex: "10", }, ".cm-lineNumbers .cm-gutterElement": { + cursor: "pointer", paddingRight: "16px", userSelect: "none", },