-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search refactor proposal #1833
Comments
Sounds good to me, at least as an internal API initially until we figure out if we should surface the ranges outside 😃
We can't really do this as the scroll bars in vscode and xterm.js have different implementations and can't really be shared (easily at least). Also ranges are invalidated when the lines shift, but we could get around this by using markers (Terminal.addMarker) to keep track of the ranges. @mofux suggested in #1380 (comment) that we support decorations which could let us do something like that though (basically markers with some visuals). |
About the line cache: Should we do this at a higher level, maybe in the buffer? To me it seems This kinda affects the current discussion about the search plugin and the linkify stuff over here #1825. |
@jerch I'm worried about the extra memory it would consume if we did this for the whole buffer. Is it only the viewport that we access often? Perhaps we could just cache those lines while they exist? |
@yeah true, memory consumption would be quite high. I think there are different needs regarding whole buffer vs. just the viewport buffer access:
What currently makes Edit: I think the question here is whether we should optimize the buffer for |
Forked that discussion to #1836 |
Hi! :) I was playing around with hooking up No pressure to decide one way or the other, I just wanted to add another datapoint. -- The Atom find-and-replace api is similar to what you've described in the top comment: there's a search function ( Returning the |
We can consider this while doing #1653, merging |
So I've been thinking about this over sleep 😴. There are a number of search related issues:
#1826 introduces the concept of a lineCache with a ttl, that the search creates when findNext/findPrevious are called. Even with 10,000 lines in buffer, it's quite fast to scan the entire buffer for search results.
I propose we refactor search to fix multiple issues and yet make it elegant.
implement a
getRangesForSearchTerm(term:string, searchOptions: ISearchOptions): IRange[]
for the same search term, findNext/findPrevious goes to the adjacent IRange and highlights the selection.
if the term is not the same as last one, then we call getRangesForSearchTerm(..) and move the highlight to the adjacent range depending on whether search was incremental or not.
VSCode / other clients can also use the IRange results to show scrollbar decorations of where search matched.
The text was updated successfully, but these errors were encountered: