vim-patch:8.1.0574: 'commentstring', fold marker in C (#9339)

Problem:    'commentstring' not used when adding fold marker in C.
Solution:   Require white space before middle comment part. (mostly by
            Hirohito Higashi)
4af7259b2b
This commit is contained in:
Jan Edmund Lazo
2018-12-09 21:11:56 -05:00
committed by Justin M. Keyes
parent 20620bae76
commit 55c5185884
2 changed files with 35 additions and 8 deletions

View File

@@ -1099,7 +1099,6 @@ int get_last_leader_offset(char_u *line, char_u **flags)
found_one = FALSE;
for (list = curbuf->b_p_com; *list; ) {
char_u *flags_save = list;
bool is_only_whitespace = false;
/*
* Get one option part into part_buf[]. Advance list to next one.
@@ -1126,9 +1125,6 @@ int get_last_leader_offset(char_u *line, char_u **flags)
while (ascii_iswhite(*string)) {
string++;
}
if (*string == NUL) {
is_only_whitespace = true;
}
}
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
/* do nothing */;
@@ -1144,10 +1140,12 @@ int get_last_leader_offset(char_u *line, char_u **flags)
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) {
if (vim_strchr(part_buf, COM_MIDDLE) != NULL) {
// For a middlepart comment, only consider it to match if
// everything before the current position in the line is
// whitespace. Otherwise we would think we are inside a
// comment if the middle part appears somewhere in the middle
// of the line. E.g. for C the "*" appears often.
for (j = 0; ascii_iswhite(line[j]) && j <= i; j++) {
}
if (j < i) {