On Oct 27, 8:33 pm, lolilolicon <[email protected]> wrote:
> This bug is tracked down to the line
>
>   filetype indent on
>
> in my ~/.vimrc; I opened the C file with `vim --noplugin foo.c' and
> reduced my ~/.vimrc to contain only the above line.
>
> `:set filetype' outputs `filetype=c'.
> `:filetype' outputs `filetype detection:ON  plugin:OFF  indent:ON'.
>
> To reproduce:
>
> 1. Put the following in .vimrc:
>
>   filetype indent on
>
> 2. Save the following as foo.c,
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <xcb/xcb.h>
>
> int main(int argc, const char *argv[])
> {
>   /* geometric objects */
>
>   xcb_rectangle_t rectangles[] = {
>     { 10, 50, 40, 20},
>     { 80, 50, 10, 40}};
>
> }
>
> 3. Open foo.c with VIM, move cursor to the line
>
>     { 80, 50, 10, 40}};
>
> press `o'. VIM freezes, as if in a dead loop.
>
> 4. ^C to break out of the loop. A newline is inserted, the new line
> is not indented.

The following change fixes this:

diff -r 379a6398d462 src/misc1.c
--- a/src/misc1.c       Wed Oct 26 23:48:21 2011 +0200
+++ b/src/misc1.c       Sat Oct 29 13:31:55 2011 +0530
@@ -7952,8 +7952,10 @@
                        /*
                         * If we're at the end of a block, skip to the start of
                         * that block.
+                        * Get the actual line without skipping any whitespace 
so
+                        * that we have the correct column.
                         */
-                       if (find_last_paren(l, '{', '}')
+                       if (find_last_paren(ml_get_curline(), '{', '}')
                                && (trypos = find_start_brace(ind_maxcomment))
                                                            != NULL) /* XXX */
                        {

-- 
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

Raspunde prin e-mail lui