Repository: vscode
Issue: The search and replace button inside a file
Labels: bug,polish,editor-find

Type: <b>Bug</b>

When using the Ctrl+F and searching for an item to replace it with a new value, every time you change an item, the current position of the search gets lost. For example lets see how this happens changing the variable "counter" to "new_counter" in a fragment of code. Image the case I am at the appearance 40 of 60, every time I click enter on the replacing text field or press the replace button for a single appearance, after the search goes directly to the appearance 1 of 59 or some different value. It should go to the appearance 40 of 59, that would be the next one, to be able to change the appearances sequentially.

VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:34:12.840Z)
OS version: Linux x64 6.5.0-28-generic
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (8 x 3524)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: disabled_software<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|1, 0, 0|
|Memory (System)|15.30GB (6.29GB free)|
|Process Argv|--unity-launch --crash-reporter-id 11c8b0a6-8f9a-4aca-926d-d0ef5857ce8c|
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|ubuntu|
|XDG_CURRENT_DESKTOP|Unity|
|XDG_SESSION_DESKTOP|ubuntu|
|XDG_SESSION_TYPE|wayland|
</details><details><summary>Extensions (45)</summary>

Extension|Author (truncated)|Version
---|---|---
language-x86-64-assembly|13x|3.1.4
vscode-django|bat|1.15.0
flask-snippets|cst|0.1.3
vscode-office|cwe|3.3.2
c-cpp-compile-run|dan|1.0.58
vscode-html-css|ecm|2.0.9
code-runner|for|0.12.2
vscode-pull-request-github|Git|0.86.1
gnuplot|mam|1.0.5
vscode-language-pack-es|MS-|1.88.2024041009
debugpy|ms-|2024.4.0
isort|ms-|2023.10.1
python|ms-|2024.4.1
vscode-pylance|ms-|2024.4.1
jupyter|ms-|2024.3.1
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.17
vscode-jupyter-cell-tags|ms-|0.1.9
vscode-jupyter-slideshow|ms-|0.1.6
remote-containers|ms-|0.354.0
remote-ssh|ms-|0.110.1
remote-ssh-edit|ms-|0.86.0
cmake-tools|ms-|1.17.17
cpptools|ms-|1.19.9
cpptools-extension-pack|ms-|1.3.0
makefile-tools|ms-|0.9.10
remote-explorer|ms-|0.4.3
remote-server|ms-|1.5.1
nsight-vscode-edition|nvi|2023.2.32964508
vetur|oct|0.37.3
vscode-snap-texteditor|par|0.1.5
material-icon-theme|PKi|5.1.0
java|red|1.30.0
LiveServer|rit|5.7.9
pdf|tom|1.2.2
cmake|twx|0.0.17
intellicode-api-usage-examples|Vis|0.2.8
vscodeintellicode|Vis|1.3.1
vscode-java-debug|vsc|0.57.0
vscode-java-dependency|vsc|0.23.6
vscode-java-pack|vsc|0.26.0
vscode-java-test|vsc|0.41.1
vscode-maven|vsc|0.44.0
volar|Vue|2.0.14
JavaScriptSnippets|xab|1.8.0

(1 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:31000449
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
d6fi2104:30959263
cppperfnew:31000557
fegfb526:30981948
bg6jg535:30979843
ccp2r3:30993541
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
dsvsc021:30996838
jg8ic977:31013176
pythoncenvptcf:31022791

```

</details>

<!-- generated by issue reporter -->