Mercurial > vim
changeset 6501:b7b3afcae90e v7.4.578
updated for version 7.4.578
Problem: Using getcurpos() after "$" in an empty line returns a negative
number.
Solution: Don't add one when this would overflow. (Hirohito Higashi)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 14 Jan 2015 19:00:38 +0100 |
parents | 58b810ec7d19 |
children | 19fe86e589db |
files | src/eval.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -11941,7 +11941,8 @@ getpos_both(argvars, rettv, getcurpos) #endif (varnumber_T)0); if (getcurpos) - list_append_number(l, (varnumber_T)curwin->w_curswant + 1); + list_append_number(l, curwin->w_curswant == MAXCOL ? + (varnumber_T)MAXCOL : (varnumber_T)curwin->w_curswant + 1); } else rettv->vval.v_number = FALSE;