1
0
forked from aniani/vim

patch 8.2.5008: when 'formatoptions' contains "/" wrongly wrapping comment

Problem:    When 'formatoptions' contains "/" wrongly wrapping a long trailing
            comment.
Solution:   Pass the OPENLINE_FORMAT flag.
This commit is contained in:
Bram Moolenaar
2022-05-23 13:10:48 +01:00
parent 6d24b4ff69
commit 7e66778815
5 changed files with 29 additions and 7 deletions

View File

@@ -289,11 +289,28 @@ func Test_format_c_comment()
x
END
call assert_equal(expected, getline(1, '$'))
" Comment is formatted when it wraps
normal 2GA with some more text added
let expected =<< trim END
nop;
val = val; // This is a comment
// with some more text
// added
x
END
call assert_equal(expected, getline(1, '$'))
set fo-=/
" using 'indentexpr' instead of 'cindent' does not repeat a comment
setl nocindent indentexpr=2
3delete
%del
let text =<< trim END
nop;
val = val; // This is a comment
END
call setline(1, text)
normal 2Gox
let expected =<< trim END
nop;