Patch 8.0.0571
Problem:    The cursor line number becomes negative when using :z^ in an empty
            buffer. (neovim #6557)
Solution:   Correct the line number.  Also reset the column.
Files:      src/testdir/test_ex_z.vim, src/ex_cmds.c


*** ../vim-8.0.0570/src/testdir/test_ex_z.vim   2017-04-02 15:45:00.377877206 
+0200
--- src/testdir/test_ex_z.vim   2017-04-20 21:06:59.478318230 +0200
***************
*** 68,74 ****
    bw!
  endfunc
  
! func Test_z_bug()
    " This used to access invalid memory as a result of an integer overflow
    " and freeze vim.
    normal ox
--- 68,74 ----
    bw!
  endfunc
  
! func Test_z_overflow()
    " This used to access invalid memory as a result of an integer overflow
    " and freeze vim.
    normal ox
***************
*** 76,78 ****
--- 76,85 ----
    z777777776666666
    ')
  endfunc
+ 
+ func Test_z_negative_lnum()
+   new
+   z^
+   call assert_equal(1, line('.'))
+   bwipe!
+ endfunc
*** ../vim-8.0.0570/src/ex_cmds.c       2017-04-02 15:45:00.377877206 +0200
--- src/ex_cmds.c       2017-04-20 21:03:35.255628443 +0200
***************
*** 4664,4669 ****
--- 4664,4671 ----
  
      if (curs > curbuf->b_ml.ml_line_count)
        curs = curbuf->b_ml.ml_line_count;
+     else if (curs < 1)
+       curs = 1;
  
      for (i = start; i <= end; i++)
      {
***************
*** 4686,4692 ****
        }
      }
  
!     curwin->w_cursor.lnum = curs;
      ex_no_reprint = TRUE;
  }
  
--- 4688,4698 ----
        }
      }
  
!     if (curwin->w_cursor.lnum != curs)
!     {
!       curwin->w_cursor.lnum = curs;
!       curwin->w_cursor.col = 0;
!     }
      ex_no_reprint = TRUE;
  }
  
*** ../vim-8.0.0570/src/version.c       2017-04-20 20:19:57.880326819 +0200
--- src/version.c       2017-04-20 21:11:55.280413572 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     571,
  /**/

-- 
WOMAN:   Well, 'ow did you become king then?
ARTHUR:  The Lady of the Lake, [angels sing] her arm clad in the purest
         shimmering samite, held aloft Excalibur from the bosom of the water
         signifying by Divine Providence that I, Arthur, was to carry
         Excalibur.  [singing stops] That is why I am your king!
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui