Keep point where the user put it while results stream in - #2170
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-preservealready 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 throughprojectile-replace--render-function, and the scan-driven redraws use it.I kept point preserved rather than made it follow the tail:
grep-modeandcompilation-modedon'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.