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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user