File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2288,6 +2288,7 @@ test_arglist \
22882288 test_syn_attr \
22892289 test_syntax \
22902290 test_system \
2291+ test_tab \
22912292 test_tabline \
22922293 test_tabpage \
22932294 test_tagcase \
Original file line number Diff line number Diff line change @@ -9373,7 +9373,7 @@ ins_bs(
93739373 if (p_sta && in_indent )
93749374 want_vcol = (want_vcol / curbuf -> b_p_sw ) * curbuf -> b_p_sw ;
93759375 else
9376- want_vcol = tabstop_start (want_vcol , curbuf -> b_p_sts ,
9376+ want_vcol = tabstop_start (want_vcol , get_sts_value () ,
93779377 curbuf -> b_p_vsts_array );
93789378#else
93799379 want_vcol = (want_vcol / ts ) * ts ;
@@ -10203,9 +10203,9 @@ ins_tab(void)
1020310203 temp = (int )curbuf -> b_p_sw ;
1020410204 temp -= get_nolist_virtcol () % temp ;
1020510205 }
10206- else if (tabstop_count (curbuf -> b_p_vsts_array ) > 0 || curbuf -> b_p_sts > 0 )
10206+ else if (tabstop_count (curbuf -> b_p_vsts_array ) > 0 || curbuf -> b_p_sts != 0 )
1020710207 /* use 'softtabstop' when set */
10208- temp = tabstop_padding (get_nolist_virtcol (), curbuf -> b_p_sts ,
10208+ temp = tabstop_padding (get_nolist_virtcol (), get_sts_value () ,
1020910209 curbuf -> b_p_vsts_array );
1021010210 else /* otherwise use 'tabstop' */
1021110211 temp = tabstop_padding (get_nolist_virtcol (), curbuf -> b_p_ts ,
Original file line number Diff line number Diff line change @@ -13016,7 +13016,7 @@ get_sw_value(buf_T *buf)
1301613016
1301713017/*
1301813018 * Return the effective softtabstop value for the current buffer, using the
13019- * 'tabstop ' value when 'softtabstop' is negative.
13019+ * 'shiftwidth ' value when 'softtabstop' is negative.
1302013020 */
1302113021 long
1302213022get_sts_value (void )
Original file line number Diff line number Diff line change 1+ " Various tests for inserting a Tab.
12
23" Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
34" Also test that dv_ works correctly
@@ -43,3 +44,38 @@ func Test_smarttab()
4344 enew !
4445 set expandtab & smartindent & copyindent & ts & sw & sts &
4546endfunc
47+
48+ func Test_softtabstop ()
49+ new
50+ set sts = 0 sw = 0
51+ exe " normal ix\<Tab> x\<Esc> "
52+ call assert_equal (" x\t x" , getline (1 ))
53+
54+ call setline (1 , ' ' )
55+ set sts = 4
56+ exe " normal ix\<Tab> x\<Esc> "
57+ call assert_equal (" x x" , getline (1 ))
58+
59+ call setline (1 , ' ' )
60+ set sts = -1 sw = 4
61+ exe " normal ix\<Tab> x\<Esc> "
62+ call assert_equal (" x x" , getline (1 ))
63+
64+ call setline (1 , ' x ' )
65+ set sts = 0 sw = 0 backspace = start
66+ exe " normal A\<BS> x\<Esc> "
67+ call assert_equal (" x x" , getline (1 ))
68+
69+ call setline (1 , ' x ' )
70+ set sts = 4
71+ exe " normal A\<BS> x\<Esc> "
72+ call assert_equal (" x x" , getline (1 ))
73+
74+ call setline (1 , ' x ' )
75+ set sts = -1 sw = 4
76+ exe " normal A\<BS> x\<Esc> "
77+ call assert_equal (" x x" , getline (1 ))
78+
79+ set sts = 0 sw = 0 backspace &
80+ bwipe!
81+ endfunc
Original file line number Diff line number Diff line change @@ -789,6 +789,8 @@ static char *(features[]) =
789789
790790static int included_patches [] =
791791{ /* Add new patch number below this line */
792+ /**/
793+ 138 ,
792794/**/
793795 137 ,
794796/**/
You can’t perform that action at this time.
0 commit comments