On Fri, Jun 29, 2012 at 03:05:02PM +0200, Bram Moolenaar wrote:
> 
> Patch 7.3.576
> Problem:    Formatting of lists inside comments is not right yet.
> Solution:   Use another solution and add a test. (Tor Perkins)
> Files:            src/edit.c, src/misc1.c, src/testdir/test68.in,
>           src/testdir/test69.ok

In reviewing this patch, I noticed two small things to fix
(please find a new patch attached)...

To explain, first, there is no need for changed_bytes() to be inside
this tight loop (oops!):

  diff -p ./src/edit.c.org ./src/edit.c
  *** ./src/edit.c.org  Wed Jun 13 07:54:56 2012
  --- ./src/edit.c  Wed Jun 13 07:56:08 2012
  *************** internal_format(textwidth, second_indent
  *** 6352,6359 ****
          for (i = 0; i < padding; i++)
          {
              ins_str((char_u *)" ");
  -           changed_bytes(curwin->w_cursor.lnum, leader_len);
          }
            }
            else
            {
  --- 6352,6359 ----
          for (i = 0; i < padding; i++)
          {
              ins_str((char_u *)" ");
          }
  +       changed_bytes(curwin->w_cursor.lnum, leader_len);
            }
            else
            {

Second, the test case got two new tests added to the "in" file, but no
new expected results were added to the "ok" file (so 'make test' is
broken).  I think only one new test needs to be added, so I remove the
second test (which functionally overlaps the first) and add the "ok"
result for the one new test...

- 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
diff -p ./src/edit.c.org ./src/edit.c
*** ./src/edit.c.org	Wed Jun 13 07:54:56 2012
--- ./src/edit.c	Wed Jun 13 07:56:08 2012
*************** internal_format(textwidth, second_indent
*** 6352,6359 ****
  			for (i = 0; i < padding; i++)
  			{
  			    ins_str((char_u *)" ");
- 			    changed_bytes(curwin->w_cursor.lnum, leader_len);
  			}
  		    }
  		    else
  		    {
--- 6352,6359 ----
  			for (i = 0; i < padding; i++)
  			{
  			    ins_str((char_u *)" ");
  			}
+ 			changed_bytes(curwin->w_cursor.lnum, leader_len);
  		    }
  		    else
  		    {
diff -p ./src/testdir/test68.in.org ./src/testdir/test68.in
*** ./src/testdir/test68.in.org	Wed Jun 13 08:08:20 2012
--- ./src/testdir/test68.in	Wed Jun 13 08:06:14 2012
*************** ENDTEST
*** 94,107 ****
  }
  
  STARTTEST
- /^#/
- :setl tw=12 fo=tqnc comments=:#
- A foobar
- ENDTEST
- 
- # 1 xxxxx
- 
- STARTTEST
  :g/^STARTTEST/.,/^ENDTEST/d
  :1;/^Results/,$wq! test.out
  ENDTEST
--- 94,99 ----
diff -p ./src/testdir/test68.ok.org ./src/testdir/test68.ok
*** ./src/testdir/test68.ok.org	Wed Jun 13 08:09:05 2012
--- ./src/testdir/test68.ok	Wed Jun 13 08:09:58 2012
*************** a b
*** 35,40 ****
--- 35,48 ----
  
  
  {
+   1 a
+     b
+ # 1 a
+ #   b
+ }
+ 
+ 
+ {
  # 1 a
  #   b
  }

Raspunde prin e-mail lui