Patch 9.0.1078

4 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 19, 2022, 10:52:30 AM12/19/22
to vim...@googlegroups.com

Patch 9.0.1078
Problem: With the +vartabs feature indent folding may use wrong 'tabstop'.
Solution: Use the "buf" argument instead of "curbuf".
Files: src/indent.c, src/testdir/test_fold.vim


*** ../vim-9.0.1077/src/indent.c 2022-10-15 16:04:43.998187220 +0100
--- src/indent.c 2022-12-19 15:50:04.019923725 +0000
***************
*** 420,426 ****
{
# ifdef FEAT_VARTABS
return get_indent_str_vtab(ml_get_buf(buf, lnum, FALSE),
! (int)curbuf->b_p_ts, buf->b_p_vts_array, FALSE);
# else
return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE);
# endif
--- 420,426 ----
{
# ifdef FEAT_VARTABS
return get_indent_str_vtab(ml_get_buf(buf, lnum, FALSE),
! (int)buf->b_p_ts, buf->b_p_vts_array, FALSE);
# else
return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE);
# endif
*** ../vim-9.0.1077/src/testdir/test_fold.vim 2022-11-11 22:57:41.774304953 +0000
--- src/testdir/test_fold.vim 2022-12-19 15:51:09.223938033 +0000
***************
*** 157,162 ****
--- 157,183 ----
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']
*** ../vim-9.0.1077/src/version.c 2022-12-19 13:30:34.319772241 +0000
--- src/version.c 2022-12-19 15:49:58.791922384 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1078,
/**/

--
Vim is like Emacs without all the typing. (John "Johann" Spetz)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages