Repository: vscode
Issue: Minor indentation inconsistency - trimAutoWhitespace - difference between tab and shift-tab
Labels: bug,editor-autoindent

Type: <b>Bug</b>

editor.autoIndent = keep
editor.trimAutoWhitespace = yes
Language: C
Indent with tabs
tab size = 8

Start state: Cursor at the end of a line:
[tab][tab]int x;

All scenarios refer to start state.

Scenario 1: press enter-enter
Cursor at indentation at [tab][tab] as expected.
Middle line is empty. Auto whitespace trimmed as expected.

Scenario 2: press enter-tab-enter
Cursor at indentation at [tab][tab][tab] as expected.
Middle line is empty. Our extra tab is considered "auto white space".

Scenario 3: press enter-shift-tab-enter
Cursor at indentation at [tab] as expected.
Middle line contains a tab. Our shift-tab turn indentation to non-auto.

Scenario 4: press enter-shift-tab-tab-enter
Middle line is empty. The tab changed back indentation to auto.

Scenario 5: press enter-tab-shift-tab-enter
Middle line has [tab][tab]. The shift-tab changed back indentation to non-auto.

In general it seems that pressing tab maintains line auto-whitespace state while pressing shift-tab revokes the auto-whitespace state.
My opinion is that shift-tab should maintain auto whitespace state as well. Maybe even backspace.

VS Code version: Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161, 2022-12-20T10:29:14.590Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: No
Remote OS version: Linux x64 6.5.6-300.fc39.x86_64

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz (4 x 2112)|
|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_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.75GB (5.19GB free)|
|Process Argv|--crash-reporter-id d3723cdb-8874-46c1-9e7a-40340e035fa3|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: upstream|
|OS|Linux x64 6.5.6-300.fc39.x86_64|
|CPUs|Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz (56 x 1200)|
|Memory (System)|251.47GB (248.27GB free)|
|VM|0%|
</details><details><summary>Extensions (7)</summary>

Extension|Author (truncated)|Version
---|---|---
kconfig|luv|1.0.3
remote-ssh|ms-|0.102.0
remote-ssh-edit|ms-|0.86.0
notepadplusplus-keybindings|ms-|1.0.7
remote-explorer|ms-|0.4.0
cpptools|ms-|1.18.5
code-spell-checker|str|2.20.3


</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
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelt:31048053
dsvsc021:30996838
0ee40948:31013168
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31082723

```

</details>

<!-- generated by issue reporter -->