Skip to content

feat: sticky file filter for the file tree - #164

Open
rod-stuchi wants to merge 1 commit into
dlvhdr:mainfrom
rod-stuchi:feat/stick-filter-file
Open

rod-stuchi wants to merge 1 commit into
dlvhdr:mainfrom
rod-stuchi:feat/stick-filter-file

Conversation

@rod-stuchi

@rod-stuchi rod-stuchi commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

Press tab in the t file search to switch it to sticky mode. On enter, the file tree keeps only the matching files, so navigation (j/k, n/p, g/G) and directory diffs stay within the filtered set.

  • the active filter is shown in the search box with a pin icon
  • reopening t prefills the current filter so it can be edited; an empty query clears it
  • esc in normal mode clears the filter and keeps the cursor on the current file (an active diff search still takes esc first)
  • the filter survives watch-mode reloads, and is cleared if it no longer matches any file
  • tab was bound to AcceptSuggestion in the search box, but no suggestions are ever set, so that binding is removed and tab is reused

No changes to the filetree package: filetree.SetFiles is called with the filtered slice, so the existing navigation works on it as is.

Related: #165 touches the same matching code; whichever lands second needs a small rebase.

How Did You Test this Change?

  • New tests in pkg/ui/tui_test.go: applying a sticky filter, n staying within it, clearing with esc (cursor kept), plain enter not filtering, and the filter surviving a parsedDiffMsg reload
  • go test ./... and golangci-lint v2.12.2 (0 issues)
  • Manually with go run . < examples/gh_dash_pr.diff: t → query → tab → enter keeps only the matches in the tree, j/k and n/p stay within them, reopening t edits the filter, and esc restores the full tree

AI Usage

Built with Claude Code (Claude Opus 5.5). I defined the behaviour (tab toggle inside t, esc to clear, prefill on reopen); Claude explored the codebase, wrote the implementation and tests, and I reviewed the diff and tested it manually.

Images/Videos

t typed 'section'

screenshot 2026-11-05T16 08 36

tab

screenshot 2026-11-05T16 08 48

enter

screenshot 2026-11-05T16 09 02

Press `tab` in the `t` file search to switch it to sticky mode. On
`enter`, the file tree then keeps only the matching files, so navigation
(j/k, n/p, g/G) and directory diffs stay within the filtered set.

- the active filter is shown in the search box with a pin icon
- reopening `t` prefills the current filter so it can be edited; an
  empty query clears it
- `esc` in normal mode clears the filter and keeps the cursor on the
  current file (an active diff search still takes `esc` first)
- the filter survives watch-mode reloads, and is cleared if it no longer
  matches any file
- remove the unused AcceptSuggestion `tab` binding from the search box
  (no suggestions were ever set)
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.

[feature-request] sticky and negated file filters

1 participant