diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-20 05:22:13 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-12-20 05:26:49 +0800 |
commit | b201cbfc61916a831d4a36f58284a5c1a3e006e1 (patch) | |
tree | 0a68e5433351735288d0df99dd1ff5732a69174c | |
parent | 23d8f5b870ab2a12882ba20e32d24b31c137f6a9 (diff) | |
download | rneovim-b201cbfc61916a831d4a36f58284a5c1a3e006e1.tar.gz rneovim-b201cbfc61916a831d4a36f58284a5c1a3e006e1.tar.bz2 rneovim-b201cbfc61916a831d4a36f58284a5c1a3e006e1.zip |
vim-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".
https://github.com/vim/vim/commit/07146ad1d33ba0d36b324873e5c461931e6b025e
-rw-r--r-- | src/nvim/indent.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_fold.vim | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 2777ebd18c..7d3b1f4a3f 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -378,7 +378,7 @@ int get_indent_lnum(linenr_T lnum) int get_indent_buf(buf_T *buf, linenr_T lnum) { return get_indent_str_vtab(ml_get_buf(buf, lnum, false), - curbuf->b_p_ts, + buf->b_p_ts, buf->b_p_vts_array, false); } diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index d74187537c..f19e4c8253 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -157,6 +157,27 @@ func Test_indent_fold_max() bw! endfunc +func Test_indent_fold_tabstop() + call setline(1, ['0', ' 1', ' 1', "\t2", "\t2"]) + setlocal shiftwidth=4 + setlocal foldcolumn=1 + setlocal foldlevel=2 + setlocal foldmethod=indent + redraw + call assert_equal('2 2', ScreenLines(5, 10)[0]) + vsplit + windo diffthis + botright new + " This 'tabstop' value should not be used for folding in other buffers. + setlocal tabstop=4 + diffoff! + redraw + call assert_equal('2 2', ScreenLines(5, 10)[0]) + + bwipe! + bwipe! +endfunc + func Test_manual_fold_with_filter() CheckExecutable cat for type in ['manual', 'marker'] |