Skip to content

Keep point where the user put it while results stream in - #2170

Merged
bbatsov merged 2 commits into
masterfrom
fix/preserve-point-while-streaming
Aug 20, 2026
Merged

Keep point where the user put it while results stream in#2170
bbatsov merged 2 commits into
masterfrom
fix/preserve-point-while-streaming

Conversation

@bbatsov

@bbatsov bbatsov commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Reopens #2169, which GitHub closed automatically when its base branch (the throttle PR, now merged) was deleted. Same change, rebased onto master.

Every redraw of the results buffer ended with goto-char (point-min), and a streaming scan redraws on every chunk. So navigating the matches that had already arrived - the whole reason for showing them before the scan finishes - was undone by the next batch. Point on the 4th match, one chunk later: line 1, nothing under point.

projectile-replace--render-preserve already existed for the toggle commands, but it called the replace renderer directly and so couldn't be used from a search buffer. It now goes through projectile-replace--render-function, and the scan-driven redraws use it.

I kept point preserved rather than made it follow the tail: grep-mode and compilation-mode don't scroll by default either, and the header already shows a running match count, so there's progress feedback without moving the cursor out from under you.

Every redraw of the results buffer ended with `goto-char (point-min)',
and a streaming scan redraws on every chunk.  So navigating the matches
that had already arrived - which is the whole point of showing them
before the scan finishes - was undone by the next batch.

`projectile-replace--render-preserve' already existed for the toggle
commands, but it called the replace renderer directly and so was unusable
from a search buffer.  It now goes through
`projectile-replace--render-function', and the scan-driven redraws use
it.

Restoring by line is what makes this safe here: matches are appended and
a file header keeps its line count when its tally grows, so the lines
already on screen do not move under the reader.
GitHub closed #2169 when the throttle PR's branch was deleted out from
under it; #2170 is the same change against master.
@bbatsov
bbatsov merged commit c1ad79b into master Aug 20, 2026
5 checks passed
@bbatsov
bbatsov deleted the fix/preserve-point-while-streaming branch August 20, 2026 15:09
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