-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
No longer jump to the first item after replacing phrase #17292
base: master
Are you sure you want to change the base?
Conversation
@charlttsie Can you take a look and perform a QA check on this change? |
Find and replace jumps to incorrect item in multi-root editorSteps
ResultAfter replacing the 2nd item in the 1st root, Find and replace jumps to the 2nd root and replaces the 2nd item: multiroot.mov |
94b9ae4
to
cb838d6
Compare
I pushed some changes, it turns out that results were not sorted correctly regarding multi root's order and were misaligned in state. Nice finding @juliaflejterska! |
We've finished testing the PR with @juliaflejterska, and it looks good to us. The initial issue is fixed, and we haven't found any regressions other than the issue with the multi-root editor, which no longer occurs after the recent changes 👍 |
Suggested merge commit message (convention)
Fix (find-and-replace): Find and replace no longer randomly jumps to the first found item after the replace operation. Closes #16648
Additional information
After removal of marker, we used to reset search to the first changed item. It's buggy because changed items refer to search results affected by the update algorithm, which used to change found elements, even if they were not replaced. It caused "random" jumps between items after replace.
The example might be this list of results:
I replaced one word in a paragraph containing few search results with
2
,3
and4
indices. It updated item with3
index, but it turns out that algorithm updated also items with2
i4
IDs. It's counterintuitive, and leaded to the incorrect assumption in the editing flow that we can reset to the first changed node when at least one yellow marker above the search result is removed. In this case, highlight item was pointed to2
item instead of4
item.I enforced restoring old highlight offset after operations, so it should be fine now.
Before
find-and-replace-before-2024-10-22_07.28.59.mp4
After
find-and-replace-after-2024-10-22_07.26.36.mp4