On Sun, Jul 15, 2012 at 12:55:53AM +0000, [email protected] wrote:
> Status: New
> Owner: ----
> Labels: Type-Defect Priority-Medium
> 
> New issue 74 by [email protected]: Auto-formatting comments is broken when  
> second line has different indentation and using fo+=2
> http://code.google.com/p/vim/issues/detail?id=74
> 
> [ ... ]

I believe this is the fix:

  diff -p ./src/misc1.c.org ./src/misc1.c
  *** ./src/misc1.c.org Wed Jun 13 11:58:24 2012
  --- ./src/misc1.c Wed Jun 13 12:01:43 2012
  *************** open_line(dir, flags, second_line_indent
  *** 1329,1334 ****
  --- 1329,1335 ----
          for (i = 0; i < padding; i++)
          {
            STRCAT(leader, " ");
  +         less_cols--;
            newcol++;
          }
      }

The problem is that the fo+=a flag causes the new code in open_line()
that supports second line list formatting (fo+=2) within comments
(patch 7.3.552) to be reached (indirectly) via the auto_format()
function.  This code path was untested until now...  :^)

The auto_format() function is saving the cursor position in a global
called 'saved_cursor', and retrieving that old saved cursor position
after calling format_lines().

However, open_line() steps on that global when it calls
mark_col_adjust(), which does col_adjust(&saved_cursor).

The call to mark_col_adjust() includes 'less_cols' as a param, and the
above patch gets the "house-keeping" sorted out for when having a
proper 'saved_cursor' matters...

Also, 'make test' is happy with this fix...

- Tor

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