C-comments indenting

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

C-comments indenting

Ivan Tishchenko

Hello, everyone.

Help me out on this one, please.

When I edit multiline C-comments, I often have this problem: if I add a
colon or braces, alignment gets messed up.  Usually, this is:
- lines, following open (but not closed) brace, are aligned on this
brace (like in if statement),
- line with open and closing brace, gets aligned on a first char.

I use:
atoindent
cindent
smartindent
fo=tcroqn
indentexpr=

(i.e. default c-indenting).

The only suspicious thing I've noticed is: this only happens if comment
is too long.  For example, this gets aligned ok:

/* qwer
*
* qwer: (qwer)
*
* Tops also have headers.  Header contains  level of a top, and number
of used
* slots.  (Slot is a placeholder for a down-link to lower-level top or
chunk.)
*/

But adding more lines yelds this:

/* qwer
*
* qwer:
*
* qwer:
*
* qwer:
*
....... about 70 lines like above ....
* qwer:
*
* qwer: (qwer)
*
* Tops also have headers.  Header contains  level of a top, and number
of used
* slots.  (Slot is a placeholder for a down-link to lower-level top or
           * chunk.)
*/

Thanks in advance!

WBR,
Ivan.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: C-comments indenting

Andreas Politz

Ivan Tishchenko wrote:

> Hello, everyone.
>
> Help me out on this one, please.
>
> When I edit multiline C-comments, I often have this problem: if I add a
> colon or braces, alignment gets messed up.  Usually, this is:
> - lines, following open (but not closed) brace, are aligned on this
> brace (like in if statement),
> - line with open and closing brace, gets aligned on a first char.
>
> I use:
> atoindent
> cindent
> smartindent
> fo=tcroqn
> indentexpr=
>
> (i.e. default c-indenting).
>
> The only suspicious thing I've noticed is: this only happens if comment
> is too long.  For example, this gets aligned ok:
>
> /* qwer
> *
> * qwer: (qwer)
> *
> * Tops also have headers.  Header contains  level of a top, and number
> of used
> * slots.  (Slot is a placeholder for a down-link to lower-level top or
> chunk.)
> */
>
> But adding more lines yelds this:
>
> /* qwer
> *
> * qwer:
> *
> * qwer:
> *
> * qwer:
> *
> ....... about 70 lines like above ....
> * qwer:
> *
> * qwer: (qwer)
> *
> * Tops also have headers.  Header contains  level of a top, and number
> of used
> * slots.  (Slot is a placeholder for a down-link to lower-level top or
>            * chunk.)
> */
>
> Thanks in advance!
>
> WBR,
> Ivan.
>
> >

This is hardcoded in the sourcecode.

src/misc1.c:6125:

     /*
      * max lines to search for an open comment
      */
     int ind_maxcomment = 70;


-ap

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: C-comments indenting

Ivan Tishchenko


> This is hardcoded in the sourcecode.
>
> src/misc1.c:6125:
>
>      /*
>       * max lines to search for an open comment
>       */
>      int ind_maxcomment = 70
Thanks a lot!!!  Since I build vim myself, it's fairly easy to fix the
problem for me now.  :)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---