From 0ce3674e4faaab378952ad68fd54635f9c4b6d9e Mon Sep 17 00:00:00 2001 From: victormasson Date: Mon, 30 Nov 2026 12:01:11 +0100 Subject: [PATCH] feat: Selects to the query's top and bottom with Shift+PageUp/PageDown GPUI Kit leaves Shift+PageUp and Shift+PageDown unbound in the editor. They now select from the caret to the start or end of the query, as Shift+Home and Shift+End do for the line. --- crates/barsql-ui/src/editor_commands.rs | 7 ++++++- guide/editor.md | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/barsql-ui/src/editor_commands.rs b/crates/barsql-ui/src/editor_commands.rs index 9e46413..77ea24d 100644 --- a/crates/barsql-ui/src/editor_commands.rs +++ b/crates/barsql-ui/src/editor_commands.rs @@ -1,6 +1,6 @@ use std::ops::Range; -use gpui_kit::base::input::{AddCursorAbove, AddCursorBelow}; +use gpui_kit::base::input::{AddCursorAbove, AddCursorBelow, SelectToEnd, SelectToStart}; use gpui_kit::component::RopeExt as _; use gpui_kit::component::input::{ Backspace, Copy, Cut, DeleteToNextWordEnd, DeleteToPreviousWordStart, EditorState, Escape, GoToDefinition, Paste, @@ -70,6 +70,11 @@ pub fn init(cx: &mut App) { KeyBinding::new("ctrl-shift-down", AddCursorBelow, context), ]); } + // GPUI Kit leaves Shift+PageUp/PageDown unbound; they select to the top/bottom of the query. + cx.bind_keys([ + KeyBinding::new("shift-pageup", SelectToStart, context), + KeyBinding::new("shift-pagedown", SelectToEnd, context), + ]); } // `comment` is the language's line comment prefix. None disables Toggle Comment. diff --git a/guide/editor.md b/guide/editor.md index 7689d65..8dc6552 100644 --- a/guide/editor.md +++ b/guide/editor.md @@ -7,6 +7,7 @@ - **Function completion and hover** for every engine - each dialect's built-in functions (from about 150 on SQLite to over 400 on ClickHouse) plus the server's own (user functions, extensions, ClickHouse combinators like `sumIf`), each with its signatures, return type and a short description - Driver-correct identifier quoting (PostgreSQL, MySQL, SQLite, SQL Server `[brackets]`, ClickHouse) - **VS Code-style multiple cursors** - `Ctrl/⌘+D` adds a cursor at the next occurrence of the word or selection, `Ctrl/⌘+Shift+L` at every one, `Ctrl/⌘+K Ctrl/⌘+D` skips one and `Ctrl/⌘+U` takes the last back +- **Select to the top or bottom** - `Shift+PageUp` / `Shift+PageDown` select from the caret to the start or end of the query, as `Shift+Home` / `Shift+End` do for the line - **Occurrence highlighting** - the word at the caret, or the selected text, is marked wherever else it appears - **VS Code-style line commands** - copy, cut and paste whole lines, move and duplicate lines, toggle comments - **Run selection** (`Ctrl/⌘+Enter`) - with nothing selected it runs the statement under the caret, briefly highlighting it / **run all** (`Ctrl/⌘+Shift+Enter`) / **stop** long-running queries