Repository: vscode
Issue: Join Lines should not include the line after the last fully selected line
Labels: bug,editor-commands

Type: <b>Bug</b>

- Select several _full_ lines: put the cursor at the start of the first line to be selected, then press Shift+Down several times. E.g. if I want to select 3 lines, I will select them this way and the cursor will be at the start of the 4th line.  
- Execute `Join Lines` command
   - Expected: only the selected lines are joined
   - Actual: the line after the last selected line is included in the join

This might be explained as correct behaviour if you think about it as removing all selected line breaks. But developers don't normally treat it this way: if I selected 3 lines, this is all I need to join, I don't need the 4th one to be added at the end. 

Other major IDEs and code editors only join the selected lines. Examples are `IntelliJ Idea` and `Notepad++`. 

VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z)
OS version: Windows_NT x64 10.0.22621
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz (8 x 2112)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<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>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|15.82GB (7.97GB free)|
|Process Argv|--crash-reporter-id 78edb399-aebd-4224-8197-f1211e83f080|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (5)</summary>

Extension|Author (truncated)|Version
---|---|---
gitlens|eam|2023.12.1604
intellij-idea-keybindings|k--|1.5.12
python|ms-|2023.22.1
vscode-pylance|ms-|2023.12.1
remote-wsl|ms-|0.81.8


</details><details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30899288
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
3biah626:30602489
89544117:30613380
vscrpc:30673769
a9j8j154:30646983
showlangstatbar:30737416
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialog:30910333
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30902429
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:30885898
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232
dsvsc019cf:30917260
cp7184t:30925682

```

</details>

<!-- generated by issue reporter -->