Repository: vscode
Issue: Stage block does not work at end of file
Labels: bug,diff-editor


Type: <b>Bug</b>

The recent buttons in the diff view to stage a block usually work great; however, if a block is at the very end of the file (i.e., it really ends at the file end, no trailing newline), the button will not do anything. Selecting the range and staging it manually works fine.

VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:41:02.734Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i7-1355U (12 x 2611)|
|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>skia_graphite: disabled_off<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)|31.68GB (10.70GB free)|
|Process Argv|--crash-reporter-id c825f7c3-fff7-491c-87f7-b5d6a6042748|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: WSL-ul_qoz12|
|OS|Linux x64 5.15.153.1-microsoft-standard-WSL2|
|CPUs|13th Gen Intel(R) Core(TM) i7-1355U (12 x 2611)|
|Memory (System)|15.46GB (5.93GB free)|
|VM|0%|
</details><details><summary>Extensions (46)</summary>

Extension|Author (truncated)|Version
---|---|---
composer-php-vscode|DEV|1.48.15635
intelli-php-vscode|DEV|0.12.15062
phptools-vscode|DEV|1.48.15635
profiler-php-vscode|DEV|1.48.15635
sync-scroll|dqi|1.3.1
gitlens|eam|15.1.0
texlab|efo|5.17.0
prettier-vscode|esb|10.4.0
linter-gfortran|for|3.2.0
msys2|fou|0.10.0
codespaces|Git|1.17.1
remotehub|Git|0.62.0
vscode-github-actions|git|0.26.3
jbockle-format-files|jbo|3.4.0
language-julia|jul|1.79.2
regionfolder|map|1.0.22
language-matlab|Mat|1.2.3
git-graph|mhu|1.30.0
debugpy|ms-|2024.6.0
isort|ms-|2023.10.1
python|ms-|2024.4.1
vscode-pylance|ms-|2024.6.1
jupyter|ms-|2024.3.1
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.18
vscode-jupyter-cell-tags|ms-|0.1.9
vscode-jupyter-powertoys|ms-|0.1.1
vscode-jupyter-slideshow|ms-|0.1.6
remote-containers|ms-|0.375.0
remote-ssh|ms-|0.110.1
remote-ssh-edit|ms-|0.86.0
remote-wsl|ms-|0.88.0
vscode-remote-extensionpack|ms-|0.25.0
azure-repos|ms-|0.38.0
cmake-tools|ms-|1.18.42
cpptools|ms-|1.20.5
cpptools-extension-pack|ms-|1.3.0
hexeditor|ms-|1.9.14
makefile-tools|ms-|0.9.10
remote-explorer|ms-|0.4.3
remote-repositories|ms-|0.40.0
ninja|sur|0.0.1
pdf|tom|1.2.2
cmake|twx|0.0.17
php-debug|xde|1.34.0
explicit-folding|zok|0.23.1

(1 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelc:31048052
dsvsc021:30996838
bdiig495:31013172
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
legacy_priority:31082724

```

</details>

<!-- generated by issue reporter -->