The formatting command gqj exhibits unexpected behavior when
executed on a C line comment after a statement.  The reformatting is
applied only to the first line of the comment and not to the
following line.

Formatting of C line comments after statements was added with Patch
8.2.3787.  It generally works very well.  I've recently observed the
behavior described here.  It seems like a bug.

Steps to reproduce

 1. Start vim as:

        $ vim -N -u NONE -i NONE -c 'set cin tw=40'

    The 'tw' setting is just for convenience.

 2. Enter these lines into the buffer:

#if 0           // This is a long end of
                // line comment that
                // wraps.

 3. Replace the "a" with "another":

#if 0           // This is another long end of
                // line comment that
                // wraps.

 4. With the cursor still on the first line, attempt to reformat the
    first two lines with

        gqj

    The comment now appears like this:

#if 0           // This is another long
                // end of
                // line comment that
                // wraps.

    and the cursor is at the start of the third line.

Expected behavior

    I expected the comment to appear like this:

#if 0           // This is another long
                // end of line comment
                // that
                // wraps.

    That is, with the first two lines of the comment formatted
    together and a third line created for what was the last word of
    the second line.  That is the result obtained when "#if 0" is
    not present.

Operating system

    Ubuntu 20.03.3 LTS
    Xterm 370

Version of Vim

    8.2.3930

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211229001543.GA9765%40phoenix.

Raspunde prin e-mail lui