for (list = curbuf->b_p_com; *list; )
{
char_u *flags_save = list;
+ int is_only_whitespace = FALSE;
/*
* Get one option part into part_buf[]. Advance list to next one.
{
if (i == 0 || !VIM_ISWHITE(line[i - 1]))
continue;
- while (VIM_ISWHITE(string[0]))
+ while (VIM_ISWHITE(*string))
++string;
+ if (*string == NUL)
+ is_only_whitespace = TRUE;
}
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
/* do nothing */;
*/
if (vim_strchr(part_buf, COM_BLANK) != NULL
&& !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL)
- {
continue;
+
+ // For a middlepart comment that is only white space, only consider
+ // it to match if everything before the current position in the
+ // line is also whitespace.
+ if (is_only_whitespace && vim_strchr(part_buf, COM_MIDDLE) != NULL)
+ {
+ for (j = 0; VIM_ISWHITE(line[j]) && j <= i; j++)
+ ;
+ if (j < i)
+ continue;
}
/*
call StopVimInTerminal(buf)
call delete('Xtest_folds_with_rnu')
endfunc
+
+func Test_folds_marker_in_comment2()
+ new
+ call setline(1, ['Lorem ipsum dolor sit', 'Lorem ipsum dolor sit', 'Lorem ipsum dolor sit'])
+ setl fen fdm=marker
+ setl commentstring=<!--%s-->
+ setl comments=s:<!--,m:\ \ \ \ ,e:-->
+ norm! zf2j
+ setl nofen
+ :1y
+ call assert_equal(['Lorem ipsum dolor sit<!--{{{-->'], getreg(0,1,1))
+ :+2y
+ call assert_equal(['Lorem ipsum dolor sit<!--}}}-->'], getreg(0,1,1))
+
+ set foldmethod&
+ bwipe!
+endfunc