Patch 8.0.0542
Problem:    getpos() can return a negative line number. (haya14busa)
Solution:   Handle a zero topline and botline. (closes #1613)
Files:      src/eval.c, runtime/doc/eval.txt


*** ../vim-8.0.0541/src/eval.c  2017-03-18 19:41:45.896072895 +0100
--- src/eval.c  2017-04-03 21:48:02.968400475 +0200
***************
*** 6120,6132 ****
        if (name[1] == '0')             /* "w0": first visible line */
        {
            update_topline();
!           pos.lnum = curwin->w_topline;
            return &pos;
        }
        else if (name[1] == '$')        /* "w$": last visible line */
        {
            validate_botline();
!           pos.lnum = curwin->w_botline - 1;
            return &pos;
        }
      }
--- 6120,6135 ----
        if (name[1] == '0')             /* "w0": first visible line */
        {
            update_topline();
!           /* In silent Ex mode topline is zero, but that's not a valid line
!            * number; use one instead. */
!           pos.lnum = curwin->w_topline > 0 ? curwin->w_topline : 1;
            return &pos;
        }
        else if (name[1] == '$')        /* "w$": last visible line */
        {
            validate_botline();
!           /* In silent Ex mode botline is zero, return zero then. */
!           pos.lnum = curwin->w_botline > 0 ? curwin->w_botline - 1 : 0;
            return &pos;
        }
      }
*** ../vim-8.0.0541/runtime/doc/eval.txt        2017-03-29 14:19:21.882199174 
+0200
--- runtime/doc/eval.txt        2017-04-03 21:51:05.323245179 +0200
***************
*** 5398,5405 ****
                    $       the last line in the current buffer
                    'x      position of mark x (if the mark is not set, 0 is
                            returned)
!                   w0      first line visible in current window
!                   w$      last line visible in current window
                    v       In Visual mode: the start of the Visual area (the
                            cursor is the end).  When not in Visual mode
                            returns the cursor position.  Differs from |'<| in
--- 5413,5422 ----
                    $       the last line in the current buffer
                    'x      position of mark x (if the mark is not set, 0 is
                            returned)
!                   w0      first line visible in current window (one if the
!                           display isn't updated, e.g. in silent Ex mode)
!                   w$      last line visible in current window (this is one
!                           less than "w0" if no lines are visible)
                    v       In Visual mode: the start of the Visual area (the
                            cursor is the end).  When not in Visual mode
                            returns the cursor position.  Differs from |'<| in
*** ../vim-8.0.0541/src/version.c       2017-04-03 21:35:38.701127879 +0200
--- src/version.c       2017-04-03 21:56:07.017338505 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     542,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
267. You get an extra phone line so you can get phone calls.

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