Skip to content

feat(sidebar): add search confirm/cancel actions [3]#138

Draft
AbysmalBiscuit wants to merge 2 commits into
mathix420:masterfrom
AbysmalBiscuit:feat/sidebar-search-actions
Draft

feat(sidebar): add search confirm/cancel actions [3]#138
AbysmalBiscuit wants to merge 2 commits into
mathix420:masterfrom
AbysmalBiscuit:feat/sidebar-search-actions

Conversation

@AbysmalBiscuit

@AbysmalBiscuit AbysmalBiscuit commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

DON'T MERGE YET!

There is a small bug with it passing through enter and toggling folding on projects that's really annoying.

What & why

Sidebar fuzzy-search Enter/Esc were hardcoded in panel_filter and could not be rebound, and Enter never scrolled the activated row into view.

This turns the two search-mode operations into named, rebindable actions dispatched through the existing [[keyboard.bindings]] system, and fixes the missing scroll-into-view — without touching the terminal input path, IME, or the nav/shortcuts pass structure.

Changes

  • Three search-scoped NamedActions: SidebarSearchConfirm (Enter), SidebarSearchCancel (Esc), SidebarSearchCancelToTerminal (Shift+Esc).
  • Dispatched in event order from the focused panel's nav pass (drain_search_or_nav); handle_shortcuts drops search-scoped actions so the terminal's own Enter/Esc still reach the PTY.
  • Confirm scrolls the acted-on row into view via a focus-independent pending target, mapping a now-hidden child to its owning project header. Cancel returns to the seed row and preserves the s/a toggle filters.

Testing

cargo test -p alacritree -> 453 passed. Pure decision logic (drain_search_or_nav), panel_filter, bindings, and palette are unit-tested. App-level effects (row activation, scroll consume, terminal passthrough) are not yet automated — verify terminal Enter/Esc by hand before relying on it.

🤖 Generated with Claude Code

AbysmalBiscuit and others added 2 commits July 25, 2026 10:24
Search-mode Enter/Esc were hardcoded in panel_filter and could not be
rebound, and Enter never scrolled the activated row into view.

Add three search-scoped actions — SidebarSearchConfirm (Enter),
SidebarSearchCancel (Esc), and SidebarSearchCancelToTerminal
(Shift+Esc) — dispatched through the keyboard binding system from the
focused panel's nav pass. handle_shortcuts drops search-scoped actions
so the terminal's own Enter/Esc still reach the PTY. Confirm scrolls the
acted-on row into view via a focus-independent pending target, resolving
a now-hidden child to its owning project header. Cancel returns the
cursor to the seed row and preserves the s/a toggle filters.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Confirming a fuzzy search ran the row's full activation: a project
header toggled its expansion, and a worktree or session switched
workspace and moved focus to the terminal. Search is how you find a
row, so acting on it in the same keystroke is surprising — and for a
header destructive, collapsing the project you had just gone looking
for.

Confirm now only leaves search, puts the cursor on the highlighted row
and scrolls it in, keeping focus in the sidebar. Activation stays a
second, explicit Enter in browsing mode. That makes confirm the twin of
cancel, so both share one landing helper per panel, and the git panel
follows the same rule instead of opening a diff.

Search lists matched worktrees and sessions whatever their project's
expanded flag says, so a child under a collapsed project vanished the
moment the query cleared. Confirm expands that project first —
expand-only, and never for a header, which is what keeps selecting a
project from behaving as a toggle.

Dropping activation also drops the reason for the focus-independent
pending scroll target, which existed only because activation focused
the terminal and nulled the paint-time cursor. The ordinary cursor-move
scroll suffices once its moved flag is forced rather than keyed on
cursor identity: restoring the unfiltered list can move the same row
far off-screen. That also fixes git cancel, which could leave a
surviving row unscrolled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AbysmalBiscuit
AbysmalBiscuit force-pushed the feat/sidebar-search-actions branch from 154e43a to b68df29 Compare July 25, 2026 08:31
@AbysmalBiscuit AbysmalBiscuit changed the title feat(sidebar): add search confirm/cancel actions feat(sidebar): add search confirm/cancel actions [3] Jul 25, 2026
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.

1 participant