Skip to content
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

Find and replace doesn't scroll down #4058

Open
helenakristina opened this issue Feb 27, 2018 · 5 comments
Open

Find and replace doesn't scroll down #4058

helenakristina opened this issue Feb 27, 2018 · 5 comments

Comments

@helenakristina
Copy link

Using find and replace in a large file, and it doesn't scroll so I have to manually scroll. Sometimes when I do that the find and replace option closes, and when I open it up again, I have to retype the criteria again.

@saulshanabrook
Copy link
Member

Related to that is the larger issue around find and replace #1074

@jasongrout
Copy link
Contributor

Is this working now, with JupyterLab 1.2.x?

@krassowski
Copy link
Member

krassowski commented Apr 23, 2023

Using find and replace in a large file, and it doesn't scroll so I have to manually scroll

This definitely works in JupyterLab 3, but only partially in 4.0.0b1.

Sometimes when I do that the find and replace option closes, and when I open it up again, I have to retype the criteria again

This is addressed in 4.0.0.

@JasonWeill
Copy link
Contributor

In JupyterLab 4.1, I used "Find" to search for a string that was first present outside the viewport does not cause match no. 1 to be visible. Going to the next match causes matches no. 2, 3, etc., to be visible, and cycling around to 1 keeps 1 visible.

search-outside-viewport

@JasonWeill
Copy link
Contributor

In the current code, we deliberately do not show the first match inside startQuery, because the same code is used in restartQuery, and we don't want to lose control of the cursor after a query is restarted. We may need to modify the logic to only select the first match on the start, not on the restart, of a query.

// We do not want to show the first "current" closest to cursor as depending
// on which way the user dragged the selection it would be:
// - the first or last match when searching in selection
// - the next match when starting search using ctrl + f
// `scroll` and `select` are disabled because `startQuery` is also used as
// "restartQuery" after each text change and if those were enabled, we would
// steal the cursor.
await this.highlightNext(true, {
from: 'selection-start',
scroll: false,
select: false
});

This code was last modified in #14387 by @krassowski and @fcollonval , although the previous code had similar behavior to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants