0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.0571: negative line number when using :z^ in an empty buffer

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.
This commit is contained in:
Bram Moolenaar
2017-04-20 21:12:30 +02:00
parent c03944151f
commit a364cdb648
3 changed files with 17 additions and 2 deletions

View File

@@ -4664,6 +4664,8 @@ ex_z(exarg_T *eap)
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,7 +4688,11 @@ ex_z(exarg_T *eap)
}
}
curwin->w_cursor.lnum = curs;
if (curwin->w_cursor.lnum != curs)
{
curwin->w_cursor.lnum = curs;
curwin->w_cursor.col = 0;
}
ex_no_reprint = TRUE;
}