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 c8cf67a..94ecff7 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