mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[cm6] Avoid selecting a search match when re-opening the search panel (#12797)
GitOrigin-RevId: 32bb03b71ce56cc0dbe6f7c92cc6d85151ef1971
This commit is contained in:
parent
40cbfc451a
commit
1da94f029c
2 changed files with 6 additions and 1 deletions
|
@ -126,6 +126,11 @@ export const search = () => {
|
||||||
|
|
||||||
// select a match while searching
|
// select a match while searching
|
||||||
EditorView.updateListener.of(update => {
|
EditorView.updateListener.of(update => {
|
||||||
|
// if the search panel wasn't open, don't select a match
|
||||||
|
if (!searchPanelOpen(update.startState)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for (const tr of update.transactions) {
|
for (const tr of update.transactions) {
|
||||||
// avoid changing the selection and viewport when switching between files
|
// avoid changing the selection and viewport when switching between files
|
||||||
if (tr.annotation(restoreSearchQueryAnnotation)) {
|
if (tr.annotation(restoreSearchQueryAnnotation)) {
|
||||||
|
|
|
@ -221,7 +221,7 @@ contentLine3
|
||||||
|
|
||||||
// Search should now be open at first match
|
// Search should now be open at first match
|
||||||
cy.findByRole('search').should('have.length', 1)
|
cy.findByRole('search').should('have.length', 1)
|
||||||
cy.contains(`1 of 3`)
|
cy.contains(`0 of 3`)
|
||||||
|
|
||||||
// Repeated C-r should go to previous match
|
// Repeated C-r should go to previous match
|
||||||
cy.get('@search-input').type('{ctrl}r')
|
cy.get('@search-input').type('{ctrl}r')
|
||||||
|
|
Loading…
Reference in a new issue