mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.3787: no proper formatting of a C line comment after a statement
Problem: No proper formatting of a C line comment after a statement. Solution: Find the start of the line comment, insert the comment leader and indent the comment properly.
This commit is contained in:
@@ -89,6 +89,7 @@ internal_format(
|
||||
colnr_T col;
|
||||
colnr_T end_col;
|
||||
int wcc; // counter for whitespace chars
|
||||
int did_do_comment = FALSE;
|
||||
|
||||
virtcol = get_nolist_virtcol()
|
||||
+ char2cells(c != NUL ? c : gchar_cursor());
|
||||
@@ -352,10 +353,16 @@ internal_format(
|
||||
+ (fo_white_par ? OPENLINE_KEEPTRAIL : 0)
|
||||
+ (do_comments ? OPENLINE_DO_COM : 0)
|
||||
+ ((flags & INSCHAR_COM_LIST) ? OPENLINE_COM_LIST : 0)
|
||||
, ((flags & INSCHAR_COM_LIST) ? second_indent : old_indent));
|
||||
, ((flags & INSCHAR_COM_LIST) ? second_indent : old_indent),
|
||||
&did_do_comment);
|
||||
if (!(flags & INSCHAR_COM_LIST))
|
||||
old_indent = 0;
|
||||
|
||||
// If a comment leader was inserted, may also do this on a following
|
||||
// line.
|
||||
if (did_do_comment)
|
||||
no_leader = FALSE;
|
||||
|
||||
replace_offset = 0;
|
||||
if (first_line)
|
||||
{
|
||||
|
Reference in New Issue
Block a user