From e728d468cbdf6debeadc498b8f9f61a31d940e31 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Tue, 20 Oct 2026 15:35:29 +0200 Subject: [PATCH] reader: wide tables scroll sideways from the keys `zl` / `zh` scroll the table, code block or formula at the top of the view a few columns right or left, and `zL` / `zH` by half its width, as vim scrolls a long line. It is the first one too wide for the column that reaches down past the top of the reading view, so it is the one being read. A CSV's table in the file pane answers the same keys. Before, those only scrolled with the pointer or a trackpad. --- README.md | 1 + web/src/App.svelte | 8 +++++++- web/src/lib/DocumentPane.svelte | 6 +++++- web/src/lib/FilePane.svelte | 8 ++++++-- web/src/lib/Help.svelte | 1 + web/src/lib/commands.ts | 7 +++++-- web/src/lib/util.ts | 21 +++++++++++++++++++++ 7 files changed, 46 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 111e790..1b90da9 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ it; in the document pane it is that document. In the browse pane: | `j` / `k` | move down / up, or scroll the document when it has focus | | `gg` / `G` | first / last entry, or top / bottom of the document; a first `g`, `d`, `]` or `[` shows in the status line for a second while it waits for the second key | | `Ctrl-D` / `Ctrl-U` | half a page down / up the open document | +| `zl` / `zh`, `zL` / `zH` | scroll the table, code block or formula at the top of the view sideways, a little or by half its width | | `]]` / `[[` | the next / previous heading of the open document, in the editor too | | `gO` | the document's headings as a list — `j`/`k`, `Enter` jumps there (`:outline`) | | `gx` | open the file under the cursor in a tab of its own | diff --git a/web/src/App.svelte b/web/src/App.svelte index 90160ca..9701830 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -713,13 +713,19 @@ void runCommand('d') return } + if (previous === 'z' && ['h', 'l', 'H', 'L'].includes(key)) { + event.preventDefault() + const amount = ({ h: -1, l: 1, H: 'halfleft', L: 'halfright' } as const)[key as 'h' | 'l' | 'H' | 'L'] + if (!reading || !hooks.scrollWide(amount)) workspace.say('nothing wider than the column in view', 'error') + return + } if ((previous === ']' && key === ']') || (previous === '[' && key === '[')) { event.preventDefault() // Past the last heading there is still the end, as in vim. if (reading && !hooks.jumpHeading(key === ']' ? 1 : -1)) hooks.scrollReader(key === ']' ? 'bottom' : 'top') return } - if (key === 'g' || key === 'd' || key === ']' || key === '[') { + if (key === 'g' || key === 'd' || key === ']' || key === '[' || key === 'z') { pending = key return } diff --git a/web/src/lib/DocumentPane.svelte b/web/src/lib/DocumentPane.svelte index 5a6e230..01e0e72 100644 --- a/web/src/lib/DocumentPane.svelte +++ b/web/src/lib/DocumentPane.svelte @@ -1,5 +1,5 @@