• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision6d42026ad002e8abc9ce742a3e8b0ba7ad7cc27f (tree)
Time2022-12-20 01:00:05
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 9.0.1078: with the +vartabs feature indent folding may use wrong 'ts'

Commit: https://github.com/vim/vim/commit/07146ad1d33ba0d36b324873e5c461931e6b025e
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon Dec 19 15:51:44 2022 +0000

patch 9.0.1078: with the +vartabs feature indent folding may use wrong 'ts'
Problem: With the +vartabs feature indent folding may use wrong 'tabstop'.
Solution: Use the "buf" argument instead of "curbuf".

Change Summary

Incremental Difference

diff -r 97e0789e6d10 -r 6d42026ad002 src/indent.c
--- a/src/indent.c Mon Dec 19 14:45:05 2022 +0100
+++ b/src/indent.c Mon Dec 19 17:00:05 2022 +0100
@@ -420,7 +420,7 @@
420420 {
421421 # ifdef FEAT_VARTABS
422422 return get_indent_str_vtab(ml_get_buf(buf, lnum, FALSE),
423- (int)curbuf->b_p_ts, buf->b_p_vts_array, FALSE);
423+ (int)buf->b_p_ts, buf->b_p_vts_array, FALSE);
424424 # else
425425 return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE);
426426 # endif
diff -r 97e0789e6d10 -r 6d42026ad002 src/testdir/test_fold.vim
--- a/src/testdir/test_fold.vim Mon Dec 19 14:45:05 2022 +0100
+++ b/src/testdir/test_fold.vim Mon Dec 19 17:00:05 2022 +0100
@@ -157,6 +157,27 @@
157157 bw!
158158 endfunc
159159
160+func Test_indent_fold_tabstop()
161+ call setline(1, ['0', ' 1', ' 1', "\t2", "\t2"])
162+ setlocal shiftwidth=4
163+ setlocal foldcolumn=1
164+ setlocal foldlevel=2
165+ setlocal foldmethod=indent
166+ redraw
167+ call assert_equal('2 2', ScreenLines(5, 10)[0])
168+ vsplit
169+ windo diffthis
170+ botright new
171+ " This 'tabstop' value should not be used for folding in other buffers.
172+ setlocal tabstop=4
173+ diffoff!
174+ redraw
175+ call assert_equal('2 2', ScreenLines(5, 10)[0])
176+
177+ bwipe!
178+ bwipe!
179+endfunc
180+
160181 func Test_manual_fold_with_filter()
161182 CheckExecutable cat
162183 for type in ['manual', 'marker']
diff -r 97e0789e6d10 -r 6d42026ad002 src/version.c
--- a/src/version.c Mon Dec 19 14:45:05 2022 +0100
+++ b/src/version.c Mon Dec 19 17:00:05 2022 +0100
@@ -696,6 +696,8 @@
696696 static int included_patches[] =
697697 { /* Add new patch number below this line */
698698 /**/
699+ 1078,
700+/**/
699701 1077,
700702 /**/
701703 1076,
Show on old repository browser