Skip to content

Fix(tui): [b and ]b switch tabs from every view and panel - #27

Merged
adibhanna merged 1 commit into
ZenNotes:zn-0.14.0from
spirit-of-light:fix/bracket-b-scroll
Nov 1, 2026
Merged

adibhanna merged 1 commit into
ZenNotes:zn-0.14.0from
spirit-of-light:fix/bracket-b-scroll

Conversation

@spirit-of-light

Copy link
Copy Markdown
Contributor

With Vim mode on, [b / ]b (and gt / gT) switched tabs only while a note editor had focus. On Home, Tasks, Calendar, the database views and the side panels nothing happened, because the two-key sequences were matched only in editorKey, so the first key went straight to the surface and the sequence never completed.

handleKey now matches the buffer and tab sequences (tabSequenceKey) before handing a key to any surface other than a note editor, honouring custom keymaps. When the second key doesn't complete a sequence, the held first key is replayed to the surface and the second follows, so ] month navigation and gg keep working, one key later. Counts such as 3]b stay editor-only.

The held key lasts only until the next key. An overlay, chord, leader key, Ctrl+W prefix, mouse click, focus moving to a note editor or Vim mode turning off drops it without replaying it, and Esc cancels it.

Tests in tabsequence_test.go: ]b / [b cycle tabs from a view (fails on main: the active tab stays 0), a key that doesn't complete the sequence reaches the view, and a held key is dropped by each of the paths above. go test -race ./..., go vet ./..., go build ./cmd/zn, git diff --check and bash scripts/sandbox.sh --smoke pass. Checked by hand in the TUI: [b / ]b switch tabs from Home and Tasks.

🤖 Generated with Claude Code

With Vim mode on, `[b` / `]b` (and `gt` / `gT`) switched tabs only while
a note editor had focus, because the two-key sequences were matched
only in the editor's key path. On Home, Tasks, Calendar, the database
views and the side panels the first key went straight to the surface,
so the sequence never completed.

handleKey now matches the buffer and tab sequences before handing a
key to any surface other than a note editor, honouring custom keymaps.
When the second key does not complete a sequence, the held first key
is replayed to the surface and the second follows, so `]` month
navigation and `gg` keep working, one key later. Counts such as `3]b`
stay editor-only.

The held key lasts only until the next key: an overlay, chord, leader
key, Ctrl+W prefix, mouse click, focus moving to a note editor or Vim
mode turning off drops it without replaying it, and Esc cancels it.

Tests, the cycling one red first: `]b` / `[b` from a view, a key that
does not complete the sequence reaching the view, and a held key
dropped by each of those paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adibhanna
adibhanna changed the base branch from main to zn-0.14.0 November 1, 2026 20:03
@adibhanna
adibhanna merged commit 041da14 into ZenNotes:zn-0.14.0 Nov 1, 2026
5 checks passed
adibhanna added a commit that referenced this pull request Nov 1, 2026
…pirit-of-light)

With the review follow-ups on top of the contributor's commits.
@adibhanna

Copy link
Copy Markdown
Contributor

Thanks! It's merged into zn-0.14.0 and ships in zn 0.14.0. Holding the first key made a few surfaces wait one press, so there are four follow-ups:

  • 730f394: the Tasks calendar and the calendar panel act on [ and ] at once again (they changed the month only when another key followed, and ]] jumped two months). The Kanban board keeps g.
  • 97a823c: a held [, ] or g shows in the status bar, as pending keys do in the editor.
  • 65d44f3: a test that ]b and gt do nothing with Vim mode off.
  • 28a91f1: zn help and the README say the tab keys work from any view.

adibhanna added a commit that referenced this pull request Nov 1, 2026
…it-of-light)

With six review follow-ups on top of the contributor's commits. The merge also updates ownsKey from #27's follow-up, which read v.dayFocus, a field #30 removes: it now checks that the calendar grid has focus, so [ and ] still change the month at once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants