Mercurial > vim
diff src/popupwin.c @ 16902:23645f9a5ce2 v8.1.1452
patch 8.1.1452: line and col property of popup windows not properly checked
commit https://github.com/vim/vim/commit/b0ebbda06cf1a4a7c40cb274529c4c53de534e32
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 2 16:51:21 2019 +0200
patch 8.1.1452: line and col property of popup windows not properly checked
Problem: Line and col property of popup windows not properly checked.
Solution: Check for "+" or "-" sign.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 Jun 2019 17:00:05 +0200 |
parents | 16fd1bb2e675 |
children | 9138e2c60bf1 |
line wrap: on
line diff
--- a/src/popupwin.c +++ b/src/popupwin.c @@ -29,7 +29,7 @@ static poppos_entry_T poppos_entries[] = }; /* - * Get option value for"key", which is "line" or "col". + * Get option value for "key", which is "line" or "col". * Handles "cursor+N" and "cursor-N". */ static int @@ -47,13 +47,15 @@ popup_options_one(dict_T *dict, char_u * val = tv_get_string(&di->di_tv); if (STRNCMP(val, "cursor", 6) != 0) - return dict_get_number(dict, key); + return dict_get_number_check(dict, key); setcursor_mayforce(TRUE); s = val + 6; if (*s != NUL) { - n = strtol((char *)s, (char **)&endp, 10); + endp = s; + if (*skipwhite(s) == '+' || *skipwhite(s) == '-') + n = strtol((char *)s, (char **)&endp, 10); if (endp != NULL && *skipwhite(endp) != NUL) { semsg(_(e_invexpr2), val); @@ -902,7 +904,7 @@ f_popup_getpos(typval_T *argvars, typval dict_add_number(dict, "core_height", wp->w_height); dict_add_number(dict, "visible", - (wp->w_popup_flags & POPF_HIDDEN) == 0); + win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0); } }