1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-04-16 14:46:13 +02:00
vim/runtime/pack/dist/opt
Konfekt 7b27fc49a8
runtime(comment): consider &tabstop in lines after whitespace indent
The count `strlen()` in

```vim
line = printf(indent_start .. substitute(cms, '%s\@!', '%%', 'g'),
                       strpart(getline(lnum), strlen(indent_start)))
```

is too large if the block of lines to be operated on contains different
whitespace indenting (tab vs. spaces).

Considering using `2gcc` on the first line with 4 spaces as indenting
and on the next line using a single tab character (with &tabstop value
of 8):

Using `strlen(indent_start) = 4` for an initial indent of 4 spaces is
correct for the first line, but wrong for the next line and will
therefore wrongly comment out the tab-indented line (and possibly
deleting some content).

The new check is still too simple because it assumes that as soon as
there's a tab the whole indent is made of tabs; it's a start of entering
the mixed tab and whitespace indent rabbit hole.

fixes: 
closes: 

Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-10-05 16:19:40 +02:00
..
cfilter/plugin Use string interpolation () 2023-08-17 22:28:33 +02:00
comment runtime(comment): consider &tabstop in lines after whitespace indent 2024-10-05 16:19:40 +02:00
dvorak
editexisting/plugin runtime: Remove Brams name from a few more runtime files () 2023-08-23 21:23:07 +02:00
editorconfig runtime: Fix more typos () 2023-10-16 09:53:37 +02:00
justify/plugin patch 9.1.0025: A few typos in tests and justify.vim 2024-01-12 18:02:10 +01:00
matchit runtime(matchit): update matchit plugin to v1.20 2024-05-20 20:02:16 +02:00
nohlsearch/plugin runtime(nohlsearch): add missing loaded_hlsearch guard 2024-07-31 22:07:43 +02:00
shellmenu/plugin Update runtime files 2022-07-25 15:42:07 +01:00
swapmouse/plugin
termdebug/plugin runtime(termdebug): Fix wrong test for balloon feature 2024-08-14 14:41:02 +02:00