Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16901:ba2e4ebe7b8f | 16902:23645f9a5ce2 |
---|---|
27 {"topright", POPPOS_TOPRIGHT}, | 27 {"topright", POPPOS_TOPRIGHT}, |
28 {"center", POPPOS_CENTER} | 28 {"center", POPPOS_CENTER} |
29 }; | 29 }; |
30 | 30 |
31 /* | 31 /* |
32 * Get option value for"key", which is "line" or "col". | 32 * Get option value for "key", which is "line" or "col". |
33 * Handles "cursor+N" and "cursor-N". | 33 * Handles "cursor+N" and "cursor-N". |
34 */ | 34 */ |
35 static int | 35 static int |
36 popup_options_one(dict_T *dict, char_u *key) | 36 popup_options_one(dict_T *dict, char_u *key) |
37 { | 37 { |
45 if (di == NULL) | 45 if (di == NULL) |
46 return 0; | 46 return 0; |
47 | 47 |
48 val = tv_get_string(&di->di_tv); | 48 val = tv_get_string(&di->di_tv); |
49 if (STRNCMP(val, "cursor", 6) != 0) | 49 if (STRNCMP(val, "cursor", 6) != 0) |
50 return dict_get_number(dict, key); | 50 return dict_get_number_check(dict, key); |
51 | 51 |
52 setcursor_mayforce(TRUE); | 52 setcursor_mayforce(TRUE); |
53 s = val + 6; | 53 s = val + 6; |
54 if (*s != NUL) | 54 if (*s != NUL) |
55 { | 55 { |
56 n = strtol((char *)s, (char **)&endp, 10); | 56 endp = s; |
57 if (*skipwhite(s) == '+' || *skipwhite(s) == '-') | |
58 n = strtol((char *)s, (char **)&endp, 10); | |
57 if (endp != NULL && *skipwhite(endp) != NUL) | 59 if (endp != NULL && *skipwhite(endp) != NUL) |
58 { | 60 { |
59 semsg(_(e_invexpr2), val); | 61 semsg(_(e_invexpr2), val); |
60 return 0; | 62 return 0; |
61 } | 63 } |
900 dict_add_number(dict, "core_col", wp->w_wincol + 1 + left_extra); | 902 dict_add_number(dict, "core_col", wp->w_wincol + 1 + left_extra); |
901 dict_add_number(dict, "core_width", wp->w_width); | 903 dict_add_number(dict, "core_width", wp->w_width); |
902 dict_add_number(dict, "core_height", wp->w_height); | 904 dict_add_number(dict, "core_height", wp->w_height); |
903 | 905 |
904 dict_add_number(dict, "visible", | 906 dict_add_number(dict, "visible", |
905 (wp->w_popup_flags & POPF_HIDDEN) == 0); | 907 win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0); |
906 } | 908 } |
907 } | 909 } |
908 | 910 |
909 /* | 911 /* |
910 * f_popup_getoptions({id}) | 912 * f_popup_getoptions({id}) |