Repository navigation
fix(search): refresh F3 matches after edits with find closed - #947
eugenioenko merged 1 commit into
Conversation
Find Next treated matches as current whenever the buffer and query were unchanged. After the closed find bar restored those matches, an edit left F3 and Shift+F3 on the old lines. Remember the buffer version the matches were computed against and rescan when it moves. Fixes #940 Co-authored-by: Mangesh Raut <mangeshraut712@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
eugenioenko
left a comment
There was a problem hiding this comment.
Thank you for helping make ttt better!
Closing the find bar keeps the query, and the next F3 rebuilds matches. Those matches were then treated as current for as long as the buffer and query stayed the same, so an edit after that left F3 and Shift+F3 on the old lines.
findSessionnow stores the buffer version the matches were computed against.refreshFindSearchrescans when that version moves, including while the bar is closed.The first F3 right after Escape already rescanned, because closing the bar clears the displayed query. The stale jump is the F3 after a later edit. The functional test does that: search
foo(lines 3 and 6), Escape, F3, go to line 1, insert two lines, F3.Tested:
go test ./internal/ui/ -count=1 -run 'TestFind(Next|Prev)After'make test(pass)make lint(golangci-lint 2.15.0, 0 issues)make build && cd tests/functional && pnpm install && pnpm test audit-findreplace-bugs(10 passed, 3 expected fail)bin/ttt --size 80x24 --execon a file withfooon lines 3 and 6. Before the fix, Escape, F3, Ctrl+Home, Enter, Enter, F3 left the cursor onone. After, the same script and Shift+F3 both land onfoo.Fixes #940
Note
Cursor Bugbot is generating a summary for commit 796465b. Configure here.
Summary by CodeRabbit