vim-patch:8.2.5008: when 'formatoptions' contains "/" wrongly wrapping comment (#18717)

Problem:    When 'formatoptions' contains "/" wrongly wrapping a long trailing
            comment.
Solution:   Pass the OPENLINE_FORMAT flag.
7e66778815
This commit is contained in:
zeertzjq
2022-05-23 21:27:57 +08:00
committed by GitHub
parent 4c6626f03d
commit 4b4643be07
4 changed files with 26 additions and 7 deletions

View File

@@ -1188,7 +1188,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (flags & OPENLINE_DO_COM) {
lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, true);
if (lead_len == 0 && curbuf->b_p_cin && do_cindent && dir == FORWARD
&& !has_format_option(FO_NO_OPEN_COMS)) {
&& (!has_format_option(FO_NO_OPEN_COMS) || (flags & OPENLINE_FORMAT))) {
// Check for a line comment after code.
comment_start = check_linecomment(saved_line);
if (comment_start != MAXCOL) {