Skip to content

Select all occurences of find match doesn't respect selection scope column #142309

@ShafinKhadem

Description

@ShafinKhadem

This is an extension of #59961

It's caused by only checking lineNumber in:

if (findState.searchScope) {
const states = findState.searchScope;
let inSelection: FindMatch[] | null = [];
matches.forEach((match) => {
states.forEach((state) => {
if (match.range.endLineNumber <= state.endLineNumber && match.range.startLineNumber >= state.startLineNumber) {
inSelection!.push(match);
}
});
});
matches = inSelection;
}

Steps to reproduce:

  1. Have the following text in your editor:
    abc
    abc
    abc
    abc
    abc
    
  2. Select from 2nd abc to last a
  3. Enable find in selection, possibly by pressing Altl
  4. Press ⬅️. Now the cursor is before 2nd a.
  5. Trigger 'Select all occurences of find match'.

Notice that it selects 2nd to 5th abc, instead of 2nd to 4th:

before

Does this issue occur when all extensions are disabled?: Yes

VS Code version: Code 1.63.2 (899d46d, 2021-12-15T09:39:46.686Z)
OS version: Linux x64 5.13.0-22-generic snap
Restricted Mode: No

System Info
Item Value
CPUs AMD Ryzen 3 5300U with Radeon Graphics (8 x 2842)
GPU Status 2d_canvas: unavailable_software
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: disabled_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
Load (avg) 2, 1, 1
Memory (System) 7.12GB (1.21GB free)
Process Argv --no-sandbox --force-user-env --unity-launch --crash-reporter-id f9ef0483-9e99-46a3-9f8c-1e6a71b29e0e
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263cf:30335440
vscorecescf:30384386
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vscop804:30404766
vs360:30404995
vsrem710:30416614
py55gd98:30411514
vscexrecpromp3t1:30407762

Metadata

Metadata

Assignees

Labels

editor-multicursorEditor multiple cursor issuesfeature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions