Mercurial > vim
annotate src/popupwin.c @ 29862:ae8c7b51bb54
Added tag v9.0.0269 for changeset 8dca33bca038ace4d728f99807118d289861f410
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Aug 2022 18:45:05 +0200 |
parents | 89e1d67814a9 |
children | a6721cafbc74 |
rev | line source |
---|---|
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 * |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 * |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read a list of people who contributed. |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 */ |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 /* |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 * Implementation of popup windows. See ":help popup". |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 */ |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 #include "vim.h" |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18744
diff
changeset
|
16 #if defined(FEAT_PROP_POPUP) || defined(PROTO) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
18 typedef struct { |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
19 char *pp_name; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
20 poppos_T pp_val; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
21 } poppos_entry_T; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
22 |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
23 static poppos_entry_T poppos_entries[] = { |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
24 {"botleft", POPPOS_BOTLEFT}, |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
25 {"topleft", POPPOS_TOPLEFT}, |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
26 {"botright", POPPOS_BOTRIGHT}, |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
27 {"topright", POPPOS_TOPRIGHT}, |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
28 {"center", POPPOS_CENTER} |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
29 }; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
30 |
17789
0f7ae8010787
patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
31 static void popup_adjust_position(win_T *wp); |
0f7ae8010787
patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
32 |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 /* |
16902
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
34 * Get option value for "key", which is "line" or "col". |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
35 * Handles "cursor+N" and "cursor-N". |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
36 * Returns MAXCOL if the entry is not present. |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
37 */ |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
38 static int |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
39 popup_options_one(dict_T *dict, char_u *key) |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
40 { |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
41 dictitem_T *di; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
42 char_u *val; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
43 char_u *s; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
44 char_u *endp; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
45 int n = 0; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
46 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
47 di = dict_find(dict, key, -1); |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
48 if (di == NULL) |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
49 return MAXCOL; |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
50 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
51 val = tv_get_string(&di->di_tv); |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
52 if (STRNCMP(val, "cursor", 6) != 0) |
16902
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
53 return dict_get_number_check(dict, key); |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
54 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
55 setcursor_mayforce(TRUE); |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
56 s = val + 6; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
57 if (*s != NUL) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
58 { |
16902
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
59 endp = s; |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
60 if (*skipwhite(s) == '+' || *skipwhite(s) == '-') |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
61 n = strtol((char *)s, (char **)&endp, 10); |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
62 if (endp != NULL && *skipwhite(endp) != NUL) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
63 { |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
64 semsg(_(e_invalid_expression_str), val); |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
65 return 0; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
66 } |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
67 } |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
68 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
69 if (STRCMP(key, "line") == 0) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
70 n = screen_screenrow() + 1 + n; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
71 else // "col" |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
72 n = screen_screencol() + 1 + n; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
73 |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
74 // Zero means "not set", use -1 instead. |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
75 if (n == 0) |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
76 n = -1; |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
77 return n; |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
78 } |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
79 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
80 static void |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
81 set_padding_border(dict_T *dict, int *array, char *name, int max_val) |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
82 { |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
83 dictitem_T *di; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
84 |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
85 di = dict_find(dict, (char_u *)name, -1); |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
86 if (di != NULL) |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
87 { |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
88 if (di->di_tv.v_type != VAR_LIST) |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
89 emsg(_(e_list_required)); |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
90 else |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
91 { |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
92 list_T *list = di->di_tv.vval.v_list; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
93 listitem_T *li; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
94 int i; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
95 int nr; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
96 |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
97 for (i = 0; i < 4; ++i) |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
98 array[i] = 1; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
99 if (list != NULL) |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
100 { |
20392
4c317d8c1051
patch 8.2.0751: Vim9: performance can be improved
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
101 CHECK_LIST_MATERIALIZE(list); |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
102 for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
103 ++i, li = li->li_next) |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
104 { |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
105 nr = (int)tv_get_number(&li->li_tv); |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
106 if (nr >= 0) |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
107 array[i] = nr > max_val ? max_val : nr; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
108 } |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
109 } |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
110 } |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
111 } |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
112 } |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
113 |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
114 /* |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
115 * Used when popup options contain "moved": set default moved values. |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
116 */ |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
117 static void |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
118 set_moved_values(win_T *wp) |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
119 { |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
120 wp->w_popup_curwin = curwin; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
121 wp->w_popup_lnum = curwin->w_cursor.lnum; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
122 wp->w_popup_mincol = curwin->w_cursor.col; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
123 wp->w_popup_maxcol = curwin->w_cursor.col; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
124 } |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
125 |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
126 /* |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
127 * Used when popup options contain "moved" with "word" or "WORD". |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
128 */ |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
129 static void |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
130 set_moved_columns(win_T *wp, int flags) |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
131 { |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
132 char_u *ptr; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
133 int len = find_ident_under_cursor(&ptr, flags | FIND_NOERROR); |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
134 |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
135 if (len > 0) |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
136 { |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
137 wp->w_popup_mincol = (int)(ptr - ml_get_curline()); |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
138 wp->w_popup_maxcol = wp->w_popup_mincol + len - 1; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
139 } |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
140 } |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
141 |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
142 /* |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
143 * Used when popup options contain "mousemoved": set default moved values. |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
144 */ |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
145 static void |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
146 set_mousemoved_values(win_T *wp) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
147 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
148 wp->w_popup_mouse_row = mouse_row; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
149 wp->w_popup_mouse_mincol = mouse_col; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
150 wp->w_popup_mouse_maxcol = mouse_col; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
151 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
152 |
28187
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
153 static void |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
154 update_popup_uses_mouse_move(void) |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
155 { |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
156 popup_uses_mouse_move = FALSE; |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
157 if (popup_visible) |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
158 { |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
159 win_T *wp; |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
160 |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
161 FOR_ALL_POPUPWINS(wp) |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
162 if (wp->w_popup_mouse_row != 0) |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
163 { |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
164 popup_uses_mouse_move = TRUE; |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
165 return; |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
166 } |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
167 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
168 if (wp->w_popup_mouse_row != 0) |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
169 { |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
170 popup_uses_mouse_move = TRUE; |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
171 return; |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
172 } |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
173 } |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
174 } |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
175 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
176 /* |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
177 * Used when popup options contain "moved" with "word" or "WORD". |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
178 */ |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
179 static void |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
180 set_mousemoved_columns(win_T *wp, int flags) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
181 { |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
182 win_T *textwp; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
183 char_u *text; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
184 int col; |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
185 pos_T pos; |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
186 colnr_T mcol; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
187 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
188 if (find_word_under_cursor(mouse_row, mouse_col, TRUE, flags, |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
189 &textwp, &pos.lnum, &text, NULL, &col) == OK) |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
190 { |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
191 // convert text column to mouse column |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
192 pos.col = col; |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
193 pos.coladd = 0; |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
194 getvcol(textwp, &pos, &mcol, NULL, NULL); |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
195 wp->w_popup_mouse_mincol = mcol; |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
196 |
17328
12c1f01b304e
patch 8.1.1663: compiler warning for using size_t
Bram Moolenaar <Bram@vim.org>
parents:
17320
diff
changeset
|
197 pos.col = col + (colnr_T)STRLEN(text) - 1; |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
198 getvcol(textwp, &pos, NULL, NULL, &mcol); |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17318
diff
changeset
|
199 wp->w_popup_mouse_maxcol = mcol; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
200 vim_free(text); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
201 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
202 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
203 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
204 /* |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
205 * Return TRUE if "row"/"col" is on the border of the popup. |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
206 * The values are relative to the top-left corner. |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
207 */ |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
208 int |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
209 popup_on_border(win_T *wp, int row, int col) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
210 { |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
211 return (row == 0 && wp->w_popup_border[0] > 0) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
212 || (row == popup_height(wp) - 1 && wp->w_popup_border[2] > 0) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
213 || (col == 0 && wp->w_popup_border[3] > 0) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
214 || (col == popup_width(wp) - 1 && wp->w_popup_border[1] > 0); |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
215 } |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
216 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
217 /* |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
218 * Return TRUE and close the popup if "row"/"col" is on the "X" button of the |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
219 * popup and w_popup_close is POPCLOSE_BUTTON. |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
220 * The values are relative to the top-left corner. |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
221 * Caller should check the left mouse button was clicked. |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
222 * Return TRUE if the popup was closed. |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
223 */ |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
224 int |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
225 popup_close_if_on_X(win_T *wp, int row, int col) |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
226 { |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
227 if (wp->w_popup_close == POPCLOSE_BUTTON |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
228 && row == 0 && col == popup_width(wp) - 1) |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
229 { |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
230 popup_close_for_mouse_click(wp); |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
231 return TRUE; |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
232 } |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
233 return FALSE; |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
234 } |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
235 |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
236 // Values set when dragging a popup window starts. |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
237 static int drag_start_row; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
238 static int drag_start_col; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
239 static int drag_start_wantline; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
240 static int drag_start_wantcol; |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
241 static int drag_on_resize_handle; |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
242 |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
243 /* |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
244 * Mouse down on border of popup window: start dragging it. |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
245 * Uses mouse_col and mouse_row. |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
246 */ |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
247 void |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
248 popup_start_drag(win_T *wp, int row, int col) |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
249 { |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
250 drag_start_row = mouse_row; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
251 drag_start_col = mouse_col; |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
252 if (wp->w_wantline <= 0) |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
253 drag_start_wantline = wp->w_winrow + 1; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
254 else |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
255 drag_start_wantline = wp->w_wantline; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
256 if (wp->w_wantcol == 0) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
257 drag_start_wantcol = wp->w_wincol + 1; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
258 else |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
259 drag_start_wantcol = wp->w_wantcol; |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
260 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
261 // Stop centering the popup |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
262 if (wp->w_popup_pos == POPPOS_CENTER) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
263 wp->w_popup_pos = POPPOS_TOPLEFT; |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
264 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
265 drag_on_resize_handle = wp->w_popup_border[1] > 0 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
266 && wp->w_popup_border[2] > 0 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
267 && row == popup_height(wp) - 1 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
268 && col == popup_width(wp) - 1; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
269 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
270 if (wp->w_popup_pos != POPPOS_TOPLEFT && drag_on_resize_handle) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
271 { |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
272 if (wp->w_popup_pos == POPPOS_TOPRIGHT |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
273 || wp->w_popup_pos == POPPOS_BOTRIGHT) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
274 wp->w_wantcol = wp->w_wincol + 1; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
275 if (wp->w_popup_pos == POPPOS_BOTLEFT) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
276 wp->w_wantline = wp->w_winrow + 1; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
277 wp->w_popup_pos = POPPOS_TOPLEFT; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
278 } |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
279 } |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
280 |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
281 /* |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
282 * Mouse moved while dragging a popup window: adjust the window popup position |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
283 * or resize. |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
284 */ |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
285 void |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
286 popup_drag(win_T *wp) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
287 { |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
288 // The popup may be closed before dragging stops. |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
289 if (!win_valid_popup(wp)) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
290 return; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
291 |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
292 if ((wp->w_popup_flags & POPF_RESIZE) && drag_on_resize_handle) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
293 { |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
294 int width_inc = mouse_col - drag_start_col; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
295 int height_inc = mouse_row - drag_start_row; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
296 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
297 if (width_inc != 0) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
298 { |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
299 int width = wp->w_width + width_inc; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
300 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
301 if (width < 1) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
302 width = 1; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
303 wp->w_minwidth = width; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
304 wp->w_maxwidth = width; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
305 drag_start_col = mouse_col; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
306 } |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
307 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
308 if (height_inc != 0) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
309 { |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
310 int height = wp->w_height + height_inc; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
311 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
312 if (height < 1) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
313 height = 1; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
314 wp->w_minheight = height; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
315 wp->w_maxheight = height; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
316 drag_start_row = mouse_row; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
317 } |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
318 |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
319 popup_adjust_position(wp); |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
320 return; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
321 } |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
322 |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
323 if (!(wp->w_popup_flags & (POPF_DRAG | POPF_DRAGALL))) |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
324 return; |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
325 wp->w_wantline = drag_start_wantline + (mouse_row - drag_start_row); |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
326 if (wp->w_wantline < 1) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
327 wp->w_wantline = 1; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
328 if (wp->w_wantline > Rows) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
329 wp->w_wantline = Rows; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
330 wp->w_wantcol = drag_start_wantcol + (mouse_col - drag_start_col); |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
331 if (wp->w_wantcol < 1) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
332 wp->w_wantcol = 1; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
333 if (wp->w_wantcol > Columns) |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
334 wp->w_wantcol = Columns; |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
335 |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
336 popup_adjust_position(wp); |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
337 } |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
338 |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
339 /* |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
340 * Set w_firstline to match the current "wp->w_topline". |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
341 */ |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
342 void |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
343 popup_set_firstline(win_T *wp) |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
344 { |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
345 int height = wp->w_height; |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
346 |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
347 wp->w_firstline = wp->w_topline; |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
348 popup_adjust_position(wp); |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
349 |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
350 // we don't want the popup to get smaller, decrement the first line |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
351 // until it doesn't |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
352 while (wp->w_firstline > 1 && wp->w_height < height) |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
353 { |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
354 --wp->w_firstline; |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
355 popup_adjust_position(wp); |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
356 } |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
357 } |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
358 |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
359 /* |
17578
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
360 * Return TRUE if the position is in the popup window scrollbar. |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
361 */ |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
362 int |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
363 popup_is_in_scrollbar(win_T *wp, int row, int col) |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
364 { |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
365 return wp->w_has_scrollbar |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
366 && row >= wp->w_popup_border[0] |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
367 && row < popup_height(wp) - wp->w_popup_border[2] |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
368 && col == popup_width(wp) - wp->w_popup_border[1] - 1; |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
369 } |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
370 |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
371 |
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
372 /* |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
373 * Handle a click in a popup window, if it is in the scrollbar. |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
374 */ |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
375 void |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
376 popup_handle_scrollbar_click(win_T *wp, int row, int col) |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
377 { |
17578
696030820746
patch 8.1.1786: double click in popup scrollbar starts selection
Bram Moolenaar <Bram@vim.org>
parents:
17563
diff
changeset
|
378 if (popup_is_in_scrollbar(wp, row, col)) |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
379 { |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
380 int height = popup_height(wp); |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
381 int new_topline = wp->w_topline; |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
382 |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
383 if (row >= height / 2) |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
384 { |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
385 // Click in lower half, scroll down. |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
386 if (wp->w_topline < wp->w_buffer->b_ml.ml_line_count) |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
387 ++new_topline; |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
388 } |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
389 else if (wp->w_topline > 1) |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
390 // click on upper half, scroll up. |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
391 --new_topline; |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
392 if (new_topline != wp->w_topline) |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
393 { |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
394 set_topline(wp, new_topline); |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
395 if (wp == curwin) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
396 { |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
397 if (wp->w_cursor.lnum < wp->w_topline) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
398 { |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
399 wp->w_cursor.lnum = wp->w_topline; |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
400 check_cursor(); |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
401 } |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
402 else if (wp->w_cursor.lnum >= wp->w_botline) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
403 { |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
404 wp->w_cursor.lnum = wp->w_botline - 1; |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
405 check_cursor(); |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
406 } |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
407 } |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
408 popup_set_firstline(wp); |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
409 redraw_win_later(wp, UPD_NOT_VALID); |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
410 } |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
411 } |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
412 } |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17206
diff
changeset
|
413 |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
414 #if defined(FEAT_TIMERS) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
415 static void |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
416 popup_add_timeout(win_T *wp, int time) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
417 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
418 char_u cbbuf[50]; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
419 char_u *ptr = cbbuf; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
420 typval_T tv; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
421 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
422 vim_snprintf((char *)cbbuf, sizeof(cbbuf), |
25300
e56c8dc1a534
patch 8.2.3187: Vim9: popup timer callback is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
423 "(_) => popup_close(%d)", wp->w_id); |
e56c8dc1a534
patch 8.2.3187: Vim9: popup timer callback is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
424 if (get_lambda_tv_and_compile(&ptr, &tv, FALSE, &EVALARG_EVALUATE) == OK) |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
425 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
426 wp->w_popup_timer = create_timer(time, 0); |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
427 wp->w_popup_timer->tr_callback = get_callback(&tv); |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
428 clear_tv(&tv); |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
429 } |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
430 } |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
431 #endif |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
432 |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
433 static poppos_T |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
434 get_pos_entry(dict_T *d, int give_error) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
435 { |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
436 char_u *str = dict_get_string(d, "pos", FALSE); |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
437 int nr; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
438 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
439 if (str == NULL) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
440 return POPPOS_NONE; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
441 |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
442 for (nr = 0; nr < (int)ARRAY_LENGTH(poppos_entries); ++nr) |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
443 if (STRCMP(str, poppos_entries[nr].pp_name) == 0) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
444 return poppos_entries[nr].pp_val; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
445 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
446 if (give_error) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
447 semsg(_(e_invalid_argument_str), str); |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
448 return POPPOS_NONE; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
449 } |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
450 |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
451 /* |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
452 * Shared between popup_create() and f_popup_move(). |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 */ |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 static void |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
455 apply_move_options(win_T *wp, dict_T *d) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 { |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
457 int nr; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
458 char_u *str; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
459 dictitem_T *di; |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
460 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
461 if ((nr = dict_get_number_def(d, "minwidth", -1)) >= 0) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
462 wp->w_minwidth = nr; |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
463 if ((nr = dict_get_number_def(d, "minheight", -1)) >= 0) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
464 wp->w_minheight = nr; |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
465 if ((nr = dict_get_number_def(d, "maxwidth", -1)) >= 0) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
466 wp->w_maxwidth = nr; |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
467 if ((nr = dict_get_number_def(d, "maxheight", -1)) >= 0) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
468 wp->w_maxheight = nr; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
469 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
470 nr = popup_options_one(d, (char_u *)"line"); |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
471 if (nr != MAXCOL) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
472 wp->w_wantline = nr; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
473 nr = popup_options_one(d, (char_u *)"col"); |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
474 if (nr != MAXCOL) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
475 wp->w_wantcol = nr; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
476 |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
477 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
478 nr = dict_get_bool(d, "fixed", -1); |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
479 if (nr != -1) |
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
480 wp->w_popup_fixed = nr != 0; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
481 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
482 { |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
483 poppos_T ppt = get_pos_entry(d, TRUE); |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
484 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
485 if (ppt != POPPOS_NONE) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
486 wp->w_popup_pos = ppt; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
487 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
488 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
489 str = dict_get_string(d, "textprop", FALSE); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
490 if (str != NULL) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
491 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
492 wp->w_popup_prop_type = 0; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
493 if (*str != NUL) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
494 { |
18629
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
495 wp->w_popup_prop_win = curwin; |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
496 di = dict_find(d, (char_u *)"textpropwin", -1); |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
497 if (di != NULL) |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
498 { |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
499 wp->w_popup_prop_win = find_win_by_nr_or_id(&di->di_tv); |
23859
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
500 if (!win_valid_any_tab(wp->w_popup_prop_win)) |
18629
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
501 wp->w_popup_prop_win = curwin; |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
502 } |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
503 |
15fe2bd478b0
patch 8.1.2307: positioning popup doesn't work for buffer-local textprop
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
504 nr = find_prop_type_id(str, wp->w_popup_prop_win->w_buffer); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
505 if (nr <= 0) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
506 nr = find_prop_type_id(str, NULL); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
507 if (nr <= 0) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
508 semsg(_(e_invalid_argument_str), str); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
509 else |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
510 wp->w_popup_prop_type = nr; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
511 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
512 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
513 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
514 di = dict_find(d, (char_u *)"textpropid", -1); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
515 if (di != NULL) |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
516 wp->w_popup_prop_id = dict_get_number(d, "textpropid"); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
517 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
518 |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
519 /* |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
520 * Handle "moved" and "mousemoved" arguments. |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
521 */ |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
522 static void |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
523 handle_moved_argument(win_T *wp, dictitem_T *di, int mousemoved) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
524 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
525 if (di->di_tv.v_type == VAR_STRING && di->di_tv.vval.v_string != NULL) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
526 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
527 char_u *s = di->di_tv.vval.v_string; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
528 int flags = 0; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
529 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
530 if (STRCMP(s, "word") == 0) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
531 flags = FIND_IDENT | FIND_STRING; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
532 else if (STRCMP(s, "WORD") == 0) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
533 flags = FIND_STRING; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
534 else if (STRCMP(s, "expr") == 0) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
535 flags = FIND_IDENT | FIND_STRING | FIND_EVAL; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
536 else if (STRCMP(s, "any") != 0) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
537 semsg(_(e_invalid_argument_str), s); |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
538 if (flags != 0) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
539 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
540 if (mousemoved) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
541 set_mousemoved_columns(wp, flags); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
542 else |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
543 set_moved_columns(wp, flags); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
544 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
545 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
546 else if (di->di_tv.v_type == VAR_LIST |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
547 && di->di_tv.vval.v_list != NULL |
18398
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
548 && (di->di_tv.vval.v_list->lv_len == 2 |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
549 || di->di_tv.vval.v_list->lv_len == 3)) |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
550 { |
18398
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
551 list_T *l = di->di_tv.vval.v_list; |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
552 listitem_T *li; |
18398
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
553 int mincol; |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
554 int maxcol; |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
555 |
20392
4c317d8c1051
patch 8.2.0751: Vim9: performance can be improved
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
556 CHECK_LIST_MATERIALIZE(l); |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
557 li = l->lv_first; |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
558 if (l->lv_len == 3) |
18398
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
559 { |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
560 varnumber_T nr = tv_get_number(&l->lv_first->li_tv); |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
561 |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
562 // Three numbers, might be from popup_getoptions(). |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
563 if (mousemoved) |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
564 wp->w_popup_mouse_row = nr; |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
565 else |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
566 wp->w_popup_lnum = nr; |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
567 li = li->li_next; |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
568 if (nr == 0) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
569 wp->w_popup_curwin = NULL; |
18398
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
570 } |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
571 |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
572 mincol = tv_get_number(&li->li_tv); |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
573 maxcol = tv_get_number(&li->li_next->li_tv); |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
574 if (mousemoved) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
575 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
576 wp->w_popup_mouse_mincol = mincol; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
577 wp->w_popup_mouse_maxcol = maxcol; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
578 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
579 else |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
580 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
581 wp->w_popup_mincol = mincol; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
582 wp->w_popup_maxcol = maxcol; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
583 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
584 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
585 else |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
586 semsg(_(e_invalid_argument_str), tv_get_string(&di->di_tv)); |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
587 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
588 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
589 static void |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
590 check_highlight(dict_T *dict, char *name, char_u **pval) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
591 { |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
592 dictitem_T *di; |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
593 char_u *str; |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
594 |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
595 di = dict_find(dict, (char_u *)name, -1); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
596 if (di != NULL) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
597 { |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
598 if (di->di_tv.v_type != VAR_STRING) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
599 semsg(_(e_invalid_value_for_argument_str), name); |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
600 else |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
601 { |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
602 str = tv_get_string(&di->di_tv); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
603 if (*str != NUL) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
604 *pval = vim_strsave(str); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
605 } |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
606 } |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
607 } |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
608 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
609 /* |
18339
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
610 * Scroll to show the line with the cursor. |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
611 */ |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
612 static void |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
613 popup_show_curline(win_T *wp) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
614 { |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
615 if (wp->w_cursor.lnum < wp->w_topline) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
616 wp->w_topline = wp->w_cursor.lnum; |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
617 else if (wp->w_cursor.lnum >= wp->w_botline |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
618 && (wp->w_valid & VALID_BOTLINE)) |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
619 { |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
620 wp->w_topline = wp->w_cursor.lnum - wp->w_height + 1; |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
621 if (wp->w_topline < 1) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
622 wp->w_topline = 1; |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
623 else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
624 wp->w_topline = wp->w_buffer->b_ml.ml_line_count; |
18339
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
625 while (wp->w_topline < wp->w_cursor.lnum |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
626 && wp->w_topline < wp->w_buffer->b_ml.ml_line_count |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
627 && plines_m_win(wp, wp->w_topline, wp->w_cursor.lnum) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
628 > wp->w_height) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
629 ++wp->w_topline; |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
630 } |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
631 |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
632 // Don't let "firstline" cause a scroll. |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
633 if (wp->w_firstline > 0) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
634 wp->w_firstline = wp->w_topline; |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
635 } |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
636 |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
637 /* |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
638 * Get the sign group name for window "wp". |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
639 * Returns a pointer to a static buffer, overwritten on the next call. |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
640 */ |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
641 static char_u * |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
642 popup_get_sign_name(win_T *wp) |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
643 { |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
644 static char buf[30]; |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
645 |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
646 vim_snprintf(buf, sizeof(buf), "popup-%d", wp->w_id); |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
647 return (char_u *)buf; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
648 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
649 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
650 /* |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
651 * Highlight the line with the cursor. |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
652 * Also scrolls the text to put the cursor line in view. |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
653 */ |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
654 static void |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
655 popup_highlight_curline(win_T *wp) |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
656 { |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
657 int sign_id = 0; |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
658 char_u *sign_name = popup_get_sign_name(wp); |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
659 |
18744
b29d8a06e72c
patch 8.1.2362: cannot place signs in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18685
diff
changeset
|
660 buf_delete_signs(wp->w_buffer, (char_u *)"PopUpMenu"); |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
661 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
662 if ((wp->w_popup_flags & POPF_CURSORLINE) != 0) |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
663 { |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
664 popup_show_curline(wp); |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
665 |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
666 if (!sign_exists_by_name(sign_name)) |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
667 { |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
668 char *linehl = "PopupSelected"; |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
669 |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
670 if (syn_name2id((char_u *)linehl) == 0) |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
671 linehl = "PmenuSel"; |
26690
84d60deb8f82
patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
672 sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL, NULL, NULL); |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
673 } |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
674 |
18744
b29d8a06e72c
patch 8.1.2362: cannot place signs in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18685
diff
changeset
|
675 sign_place(&sign_id, (char_u *)"PopUpMenu", sign_name, |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
676 wp->w_buffer, wp->w_cursor.lnum, SIGN_DEF_PRIO); |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
677 redraw_win_later(wp, UPD_NOT_VALID); |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
678 } |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
679 else |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
680 sign_undefine_by_name(sign_name, FALSE); |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
681 wp->w_popup_last_curline = wp->w_cursor.lnum; |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
682 } |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
683 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
684 /* |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
685 * Shared between popup_create() and f_popup_setoptions(). |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
686 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
687 static void |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
688 apply_general_options(win_T *wp, dict_T *dict) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
689 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
690 dictitem_T *di; |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16855
diff
changeset
|
691 int nr; |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16855
diff
changeset
|
692 char_u *str; |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
693 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
694 // TODO: flip |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
695 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
696 di = dict_find(dict, (char_u *)"firstline", -1); |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
697 if (di != NULL) |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
698 { |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
699 wp->w_firstline = dict_get_number(dict, "firstline"); |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
700 if (wp->w_firstline < 0) |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
701 wp->w_firstline = -1; |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
702 } |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
703 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
704 nr = dict_get_bool(dict, "scrollbar", -1); |
22429
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
705 if (nr != -1) |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
706 wp->w_want_scrollbar = nr; |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
707 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
708 str = dict_get_string(dict, "title", FALSE); |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
709 if (str != NULL) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
710 { |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
711 vim_free(wp->w_popup_title); |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
712 wp->w_popup_title = vim_strsave(str); |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
713 } |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
714 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
715 nr = dict_get_bool(dict, "wrap", -1); |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
716 if (nr != -1) |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16855
diff
changeset
|
717 wp->w_p_wrap = nr != 0; |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
718 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
719 nr = dict_get_bool(dict, "drag", -1); |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
720 if (nr != -1) |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
721 { |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
722 if (nr) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
723 wp->w_popup_flags |= POPF_DRAG; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
724 else |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
725 wp->w_popup_flags &= ~POPF_DRAG; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
726 } |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
727 nr = dict_get_bool(dict, "dragall", -1); |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
728 if (nr != -1) |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
729 { |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
730 if (nr) |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
731 wp->w_popup_flags |= POPF_DRAGALL; |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
732 else |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
733 wp->w_popup_flags &= ~POPF_DRAGALL; |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
734 } |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
735 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
736 nr = dict_get_bool(dict, "posinvert", -1); |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
737 if (nr != -1) |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
738 { |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
739 if (nr) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
740 wp->w_popup_flags |= POPF_POSINVERT; |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
741 else |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
742 wp->w_popup_flags &= ~POPF_POSINVERT; |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
743 } |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
744 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
745 nr = dict_get_bool(dict, "resize", -1); |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
746 if (nr != -1) |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
747 { |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
748 if (nr) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
749 wp->w_popup_flags |= POPF_RESIZE; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
750 else |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
751 wp->w_popup_flags &= ~POPF_RESIZE; |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
752 } |
17051
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
753 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
754 di = dict_find(dict, (char_u *)"close", -1); |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
755 if (di != NULL) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
756 { |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
757 int ok = TRUE; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
758 |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
759 if (di->di_tv.v_type == VAR_STRING && di->di_tv.vval.v_string != NULL) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
760 { |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
761 char_u *s = di->di_tv.vval.v_string; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
762 |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
763 if (STRCMP(s, "none") == 0) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
764 wp->w_popup_close = POPCLOSE_NONE; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
765 else if (STRCMP(s, "button") == 0) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
766 wp->w_popup_close = POPCLOSE_BUTTON; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
767 else if (STRCMP(s, "click") == 0) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
768 wp->w_popup_close = POPCLOSE_CLICK; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
769 else |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
770 ok = FALSE; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
771 } |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
772 else |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
773 ok = FALSE; |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
774 if (!ok) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
775 semsg(_(e_invalid_value_for_argument_str_str), "close", tv_get_string(&di->di_tv)); |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
776 } |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
777 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
778 str = dict_get_string(dict, "highlight", FALSE); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
779 if (str != NULL) |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
780 { |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
781 set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1, |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
782 str, OPT_FREE|OPT_LOCAL, 0); |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
783 #ifdef FEAT_TERMINAL |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
784 term_update_wincolor(wp); |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
785 #endif |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
786 } |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
787 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
788 set_padding_border(dict, wp->w_popup_padding, "padding", 999); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
789 set_padding_border(dict, wp->w_popup_border, "border", 1); |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
790 |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
791 di = dict_find(dict, (char_u *)"borderhighlight", -1); |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
792 if (di != NULL) |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
793 { |
17421
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
794 if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL) |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
795 emsg(_(e_list_required)); |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
796 else |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
797 { |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
798 list_T *list = di->di_tv.vval.v_list; |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
799 listitem_T *li; |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
800 int i; |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
801 |
20392
4c317d8c1051
patch 8.2.0751: Vim9: performance can be improved
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
802 CHECK_LIST_MATERIALIZE(list); |
17421
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
803 for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; |
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
804 ++i, li = li->li_next) |
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
805 { |
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
806 str = tv_get_string(&li->li_tv); |
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
807 if (*str != NUL) |
18584
351659cbadb4
patch 8.1.2286: using border highlight in popup window leaks memory
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
808 { |
351659cbadb4
patch 8.1.2286: using border highlight in popup window leaks memory
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
809 vim_free(wp->w_border_highlight[i]); |
17421
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
810 wp->w_border_highlight[i] = vim_strsave(str); |
18584
351659cbadb4
patch 8.1.2286: using border highlight in popup window leaks memory
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
811 } |
17421
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
812 } |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
813 if (list->lv_len == 1 && wp->w_border_highlight[0] != NULL) |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
814 for (i = 1; i < 4; ++i) |
18584
351659cbadb4
patch 8.1.2286: using border highlight in popup window leaks memory
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
815 { |
351659cbadb4
patch 8.1.2286: using border highlight in popup window leaks memory
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
816 vim_free(wp->w_border_highlight[i]); |
17421
73e81cd9e6cb
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17417
diff
changeset
|
817 wp->w_border_highlight[i] = |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
818 vim_strsave(wp->w_border_highlight[0]); |
18584
351659cbadb4
patch 8.1.2286: using border highlight in popup window leaks memory
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
819 } |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
820 } |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
821 } |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
822 |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
823 di = dict_find(dict, (char_u *)"borderchars", -1); |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
824 if (di != NULL) |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
825 { |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
826 if (di->di_tv.v_type != VAR_LIST) |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
827 emsg(_(e_list_required)); |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
828 else |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
829 { |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
830 list_T *list = di->di_tv.vval.v_list; |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
831 listitem_T *li; |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
832 int i; |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
833 |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
834 if (list != NULL) |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
835 { |
20392
4c317d8c1051
patch 8.2.0751: Vim9: performance can be improved
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
836 CHECK_LIST_MATERIALIZE(list); |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
837 for (i = 0, li = list->lv_first; i < 8 && i < list->lv_len; |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
838 ++i, li = li->li_next) |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
839 { |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
840 str = tv_get_string(&li->li_tv); |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
841 if (*str != NUL) |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
842 wp->w_border_char[i] = mb_ptr2char(str); |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
843 } |
19908
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
844 if (list->lv_len == 1) |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
845 for (i = 1; i < 8; ++i) |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
846 wp->w_border_char[i] = wp->w_border_char[0]; |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
847 if (list->lv_len == 2) |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
848 { |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
849 for (i = 4; i < 8; ++i) |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
850 wp->w_border_char[i] = wp->w_border_char[1]; |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
851 for (i = 1; i < 4; ++i) |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
852 wp->w_border_char[i] = wp->w_border_char[0]; |
473ceb7f65e2
patch 8.2.0510: Coverity complains about using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
853 } |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
854 } |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
855 } |
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
856 } |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
857 |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
858 check_highlight(dict, "scrollbarhighlight", &wp->w_scrollbar_highlight); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
859 check_highlight(dict, "thumbhighlight", &wp->w_thumb_highlight); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
860 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
861 di = dict_find(dict, (char_u *)"zindex", -1); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
862 if (di != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
863 { |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
864 wp->w_zindex = dict_get_number(dict, "zindex"); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
865 if (wp->w_zindex < 1) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
866 wp->w_zindex = POPUPWIN_DEFAULT_ZINDEX; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
867 if (wp->w_zindex > 32000) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
868 wp->w_zindex = 32000; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
869 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
870 |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
871 di = dict_find(dict, (char_u *)"mask", -1); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
872 if (di != NULL) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
873 { |
17417
aa4532c1d001
patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17383
diff
changeset
|
874 int ok = FALSE; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
875 |
17417
aa4532c1d001
patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17383
diff
changeset
|
876 if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
877 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
878 listitem_T *li; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
879 |
17417
aa4532c1d001
patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17383
diff
changeset
|
880 ok = TRUE; |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
881 FOR_ALL_LIST_ITEMS(di->di_tv.vval.v_list, li) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
882 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
883 if (li->li_tv.v_type != VAR_LIST |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
884 || li->li_tv.vval.v_list == NULL |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
885 || li->li_tv.vval.v_list->lv_len != 4) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
886 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
887 ok = FALSE; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
888 break; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
889 } |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
890 else |
20392
4c317d8c1051
patch 8.2.0751: Vim9: performance can be improved
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
891 CHECK_LIST_MATERIALIZE(li->li_tv.vval.v_list); |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
892 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
893 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
894 if (ok) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
895 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
896 wp->w_popup_mask = di->di_tv.vval.v_list; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
897 ++wp->w_popup_mask->lv_refcount; |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
898 VIM_CLEAR(wp->w_popup_mask_cells); |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
899 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
900 else |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
901 semsg(_(e_invalid_value_for_argument_str), "mask"); |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
902 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
903 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
904 #if defined(FEAT_TIMERS) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
905 // Add timer to close the popup after some time. |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
906 nr = dict_get_number(dict, "time"); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
907 if (nr > 0) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
908 popup_add_timeout(wp, nr); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
909 #endif |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
910 |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
911 di = dict_find(dict, (char_u *)"moved", -1); |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
912 if (di != NULL) |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
913 { |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
914 set_moved_values(wp); |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
915 handle_moved_argument(wp, di, FALSE); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
916 } |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
917 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
918 di = dict_find(dict, (char_u *)"mousemoved", -1); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
919 if (di != NULL) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
920 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
921 set_mousemoved_values(wp); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
922 handle_moved_argument(wp, di, TRUE); |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
923 } |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
924 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
925 nr = dict_get_bool(dict, "cursorline", -1); |
23998
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
926 if (nr != -1) |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
927 { |
23998
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
928 if (nr != 0) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
929 wp->w_popup_flags |= POPF_CURSORLINE; |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
930 else |
23998
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
931 wp->w_popup_flags &= ~POPF_CURSORLINE; |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
932 } |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
933 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
934 di = dict_find(dict, (char_u *)"filter", -1); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
935 if (di != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
936 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
937 callback_T callback = get_callback(&di->di_tv); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
938 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
939 if (callback.cb_name != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
940 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
941 free_callback(&wp->w_filter_cb); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
942 set_callback(&wp->w_filter_cb, &callback); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
943 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
944 } |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
945 nr = dict_get_bool(dict, "mapping", -1); |
21857
1f6dc5b953c4
patch 8.2.1478: Vim9: cannot use "true" for some popup options
Bram Moolenaar <Bram@vim.org>
parents:
21731
diff
changeset
|
946 if (nr != -1) |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
947 { |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
948 if (nr) |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
949 wp->w_popup_flags |= POPF_MAPPING; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
950 else |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
951 wp->w_popup_flags &= ~POPF_MAPPING; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
952 } |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
953 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
954 str = dict_get_string(dict, "filtermode", FALSE); |
17946
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
955 if (str != NULL) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
956 { |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
957 if (STRCMP(str, "a") == 0) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
958 wp->w_filter_mode = MODE_ALL; |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
959 else |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
960 wp->w_filter_mode = mode_str2flags(str); |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
961 } |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
962 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
963 di = dict_find(dict, (char_u *)"callback", -1); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
964 if (di != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
965 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
966 callback_T callback = get_callback(&di->di_tv); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
967 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
968 if (callback.cb_name != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
969 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
970 free_callback(&wp->w_close_cb); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
971 set_callback(&wp->w_close_cb, &callback); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
972 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
973 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
974 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
975 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
976 /* |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
977 * Go through the options in "dict" and apply them to popup window "wp". |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
978 * "create" is TRUE when creating a new popup window. |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
979 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
980 static void |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
981 apply_options(win_T *wp, dict_T *dict, int create) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
982 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
983 int nr; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
984 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
985 apply_move_options(wp, dict); |
21506
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21377
diff
changeset
|
986 |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
987 if (create) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
988 set_string_option_direct_in_win(wp, (char_u *)"signcolumn", -1, |
21506
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21377
diff
changeset
|
989 (char_u *)"no", OPT_FREE|OPT_LOCAL, 0); |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21377
diff
changeset
|
990 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
991 apply_general_options(wp, dict); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
992 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
993 nr = dict_get_bool(dict, "hidden", FALSE); |
17121
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
994 if (nr > 0) |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
995 wp->w_popup_flags |= POPF_HIDDEN | POPF_HIDDEN_FORCE; |
17121
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
996 |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
997 // when "firstline" and "cursorline" are both set and the cursor would be |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
998 // above or below the displayed lines, move the cursor to "firstline". |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
999 if (wp->w_firstline > 0 && (wp->w_popup_flags & POPF_CURSORLINE)) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
1000 { |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
1001 if (wp->w_firstline > wp->w_buffer->b_ml.ml_line_count) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
1002 wp->w_cursor.lnum = wp->w_buffer->b_ml.ml_line_count; |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1003 else if (wp->w_cursor.lnum < wp->w_firstline |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1004 || wp->w_cursor.lnum >= wp->w_firstline + wp->w_height) |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
1005 wp->w_cursor.lnum = wp->w_firstline; |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1006 wp->w_topline = wp->w_firstline; |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1007 wp->w_valid &= ~VALID_BOTLINE; |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
1008 } |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22178
diff
changeset
|
1009 |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1010 popup_mask_refresh = TRUE; |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
1011 popup_highlight_curline(wp); |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1012 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1013 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1014 /* |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1015 * Add lines to the popup from a list of strings. |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1016 */ |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1017 static void |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1018 add_popup_strings(buf_T *buf, list_T *l) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1019 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1020 listitem_T *li; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1021 linenr_T lnum = 0; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1022 char_u *p; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1023 |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
1024 FOR_ALL_LIST_ITEMS(l, li) |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1025 if (li->li_tv.v_type == VAR_STRING) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1026 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1027 p = li->li_tv.vval.v_string; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1028 ml_append_buf(buf, lnum++, |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1029 p == NULL ? (char_u *)"" : p, (colnr_T)0, TRUE); |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1030 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1031 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1032 |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1033 /* |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1034 * Add lines to the popup from a list of dictionaries. |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1035 */ |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1036 static void |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1037 add_popup_dicts(buf_T *buf, list_T *l) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1038 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1039 listitem_T *li; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1040 listitem_T *pli; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1041 linenr_T lnum = 0; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1042 char_u *p; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1043 dict_T *dict; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1044 |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1045 // first add the text lines |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
1046 FOR_ALL_LIST_ITEMS(l, li) |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1047 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1048 if (li->li_tv.v_type != VAR_DICT) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1049 { |
29034
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1050 semsg(_(e_argument_1_list_item_nr_dictionary_required), lnum + 1); |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1051 return; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1052 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1053 dict = li->li_tv.vval.v_dict; |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
1054 p = dict == NULL ? NULL : dict_get_string(dict, "text", FALSE); |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1055 ml_append_buf(buf, lnum++, |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1056 p == NULL ? (char_u *)"" : p, (colnr_T)0, TRUE); |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1057 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1058 |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1059 // add the text properties |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1060 lnum = 1; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1061 for (li = l->lv_first; li != NULL; li = li->li_next, ++lnum) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1062 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1063 dictitem_T *di; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1064 list_T *plist; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1065 |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1066 dict = li->li_tv.vval.v_dict; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1067 di = dict_find(dict, (char_u *)"props", -1); |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1068 if (di != NULL) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1069 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1070 if (di->di_tv.v_type != VAR_LIST) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1071 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
1072 emsg(_(e_list_required)); |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1073 return; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1074 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1075 plist = di->di_tv.vval.v_list; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1076 if (plist != NULL) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1077 { |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
1078 FOR_ALL_LIST_ITEMS(plist, pli) |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1079 { |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1080 if (pli->li_tv.v_type != VAR_DICT) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1081 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
1082 emsg(_(e_dictionary_required)); |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1083 return; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1084 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1085 dict = pli->li_tv.vval.v_dict; |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1086 if (dict != NULL) |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1087 { |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
1088 int col = dict_get_number(dict, "col"); |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1089 |
29660
e134ff00be57
patch 9.0.0170: various minor code formatting issues
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
1090 prop_add_common(lnum, col, dict, buf, NULL); |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1091 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1092 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1093 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1094 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1095 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1096 } |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1097 |
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
1098 /* |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1099 * Get the padding plus border at the top, adjusted to 1 if there is a title. |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1100 */ |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1101 int |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1102 popup_top_extra(win_T *wp) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1103 { |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1104 int extra = wp->w_popup_border[0] + wp->w_popup_padding[0]; |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1105 |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1106 if (extra == 0 && wp->w_popup_title != NULL && *wp->w_popup_title != NUL) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1107 return 1; |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1108 return extra; |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1109 } |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1110 |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1111 /* |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1112 * Get the padding plus border at the left. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1113 */ |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1114 int |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1115 popup_left_extra(win_T *wp) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1116 { |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1117 return wp->w_popup_border[3] + wp->w_popup_padding[3]; |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1118 } |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1119 |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
1120 /* |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1121 * Return the height of popup window "wp", including border and padding. |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1122 */ |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1123 int |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1124 popup_height(win_T *wp) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1125 { |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1126 return wp->w_height |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1127 + popup_top_extra(wp) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1128 + wp->w_popup_padding[2] + wp->w_popup_border[2]; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1129 } |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1130 |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1131 /* |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1132 * Return the width of popup window "wp", including border, padding and |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1133 * scrollbar. |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1134 */ |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1135 int |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1136 popup_width(win_T *wp) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1137 { |
17354
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
1138 // w_leftcol is how many columns of the core are left of the screen |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
1139 // w_popup_rightoff is how many columns of the core are right of the screen |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1140 return wp->w_width + wp->w_leftcol |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1141 + popup_extra_width(wp) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1142 + wp->w_popup_rightoff; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1143 } |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1144 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1145 /* |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1146 * Return the extra width of popup window "wp": border, padding and scrollbar. |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1147 */ |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1148 int |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1149 popup_extra_width(win_T *wp) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1150 { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1151 return wp->w_popup_padding[3] + wp->w_popup_border[3] |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1152 + wp->w_popup_padding[1] + wp->w_popup_border[1] |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1153 + wp->w_has_scrollbar; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1154 } |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1155 |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1156 /* |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1157 * Adjust the position and size of the popup to fit on the screen. |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1158 */ |
17789
0f7ae8010787
patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
1159 static void |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1160 popup_adjust_position(win_T *wp) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1161 { |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1162 linenr_T lnum; |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1163 int wrapped = 0; |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1164 int maxwidth; |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1165 int maxwidth_no_scrollbar; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1166 int width_with_scrollbar = 0; |
18339
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
1167 int used_maxwidth = FALSE; |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1168 int margin_width = 0; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1169 int maxspace; |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1170 int center_vert = FALSE; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1171 int center_hor = FALSE; |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1172 int allow_adjust_left = !wp->w_popup_fixed; |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1173 int top_extra = popup_top_extra(wp); |
16898
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
1174 int right_extra = wp->w_popup_border[1] + wp->w_popup_padding[1]; |
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
1175 int bot_extra = wp->w_popup_border[2] + wp->w_popup_padding[2]; |
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
1176 int left_extra = wp->w_popup_border[3] + wp->w_popup_padding[3]; |
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
1177 int extra_height = top_extra + bot_extra; |
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
1178 int extra_width = left_extra + right_extra; |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1179 int w_height_before_limit; |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1180 int org_winrow = wp->w_winrow; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1181 int org_wincol = wp->w_wincol; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1182 int org_width = wp->w_width; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1183 int org_height = wp->w_height; |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1184 int org_leftcol = wp->w_leftcol; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1185 int org_leftoff = wp->w_popup_leftoff; |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1186 int minwidth, minheight; |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1187 int maxheight = Rows; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1188 int wantline = wp->w_wantline; // adjusted for textprop |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1189 int wantcol = wp->w_wantcol; // adjusted for textprop |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
1190 int use_wantcol = wantcol != 0; |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1191 int adjust_height_for_top_aligned = FALSE; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1192 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1193 wp->w_winrow = 0; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1194 wp->w_wincol = 0; |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1195 wp->w_leftcol = 0; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1196 wp->w_popup_leftoff = 0; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1197 wp->w_popup_rightoff = 0; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1198 |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1199 // May need to update the "cursorline" highlighting, which may also change |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1200 // "topline" |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1201 if (wp->w_popup_last_curline != wp->w_cursor.lnum) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1202 popup_highlight_curline(wp); |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1203 |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1204 if (wp->w_popup_prop_type > 0 && win_valid(wp->w_popup_prop_win)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1205 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1206 win_T *prop_win = wp->w_popup_prop_win; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1207 textprop_T prop; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1208 linenr_T prop_lnum; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1209 pos_T pos; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1210 int screen_row; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1211 int screen_scol; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1212 int screen_ccol; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1213 int screen_ecol; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1214 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1215 // Popup window is positioned relative to a text property. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1216 if (find_visible_prop(prop_win, |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1217 wp->w_popup_prop_type, wp->w_popup_prop_id, |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1218 &prop, &prop_lnum) == FAIL) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1219 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1220 // Text property is no longer visible, hide the popup. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1221 // Unhiding the popup is done in check_popup_unhidden(). |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1222 if ((wp->w_popup_flags & POPF_HIDDEN) == 0) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1223 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1224 wp->w_popup_flags |= POPF_HIDDEN; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1225 if (win_valid(wp->w_popup_prop_win)) |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
1226 redraw_win_later(wp->w_popup_prop_win, UPD_SOME_VALID); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1227 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1228 return; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1229 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1230 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1231 // Compute the desired position from the position of the text |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1232 // property. Use "wantline" and "wantcol" as offsets. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1233 pos.lnum = prop_lnum; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1234 pos.col = prop.tp_col; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1235 if (wp->w_popup_pos == POPPOS_TOPLEFT |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1236 || wp->w_popup_pos == POPPOS_BOTLEFT) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1237 pos.col += prop.tp_len - 1; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1238 textpos2screenpos(prop_win, &pos, &screen_row, |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1239 &screen_scol, &screen_ccol, &screen_ecol); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1240 |
23897
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
1241 if (screen_scol == 0) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
1242 { |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
1243 // position is off screen, make the width zero to hide it. |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
1244 wp->w_width = 0; |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
1245 return; |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
1246 } |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1247 if (wp->w_popup_pos == POPPOS_TOPLEFT |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1248 || wp->w_popup_pos == POPPOS_TOPRIGHT) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1249 // below the text |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1250 wantline = screen_row + wantline + 1; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1251 else |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1252 // above the text |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1253 wantline = screen_row + wantline - 1; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1254 center_vert = FALSE; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1255 if (wp->w_popup_pos == POPPOS_TOPLEFT |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1256 || wp->w_popup_pos == POPPOS_BOTLEFT) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1257 // right of the text |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1258 wantcol = screen_ecol + wantcol; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1259 else |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1260 // left of the text |
17875
f13a5c48320b
patch 8.1.1934: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17863
diff
changeset
|
1261 wantcol = screen_scol + wantcol - 2; |
18438
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1262 use_wantcol = TRUE; |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1263 } |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1264 else |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1265 { |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1266 // If no line was specified default to vertical centering. |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1267 if (wantline == 0) |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1268 center_vert = TRUE; |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1269 else if (wantline < 0) |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1270 // If "wantline" is negative it actually means zero. |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1271 wantline = 0; |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1272 if (wantcol < 0) |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1273 // If "wantcol" is negative it actually means zero. |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1274 wantcol = 0; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1275 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1276 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1277 if (wp->w_popup_pos == POPPOS_CENTER) |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1278 { |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1279 // center after computing the size |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1280 center_vert = TRUE; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1281 center_hor = TRUE; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1282 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1283 else |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1284 { |
18438
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1285 if (wantline > 0 && (wp->w_popup_pos == POPPOS_TOPLEFT |
144fa40ee706
patch 8.1.2213: popup_textprop tests fail
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
1286 || wp->w_popup_pos == POPPOS_TOPRIGHT)) |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1287 { |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1288 wp->w_winrow = wantline - 1; |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1289 if (wp->w_winrow >= Rows) |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1290 wp->w_winrow = Rows - 1; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1291 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1292 |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
1293 if (!use_wantcol) |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1294 center_hor = TRUE; |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
1295 else if (wantcol > 0 && (wp->w_popup_pos == POPPOS_TOPLEFT |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
1296 || wp->w_popup_pos == POPPOS_BOTLEFT)) |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1297 { |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1298 wp->w_wincol = wantcol - 1; |
19605
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19546
diff
changeset
|
1299 // Need to see at least one character after the decoration. |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19546
diff
changeset
|
1300 if (wp->w_wincol > Columns - left_extra - 1) |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19546
diff
changeset
|
1301 wp->w_wincol = Columns - left_extra - 1; |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1302 } |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1303 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1304 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1305 // When centering or right aligned, use maximum width. |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1306 // When left aligned use the space available, but shift to the left when we |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1307 // hit the right of the screen. |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1308 maxspace = Columns - wp->w_wincol - left_extra; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1309 maxwidth = maxspace; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1310 if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1311 { |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1312 allow_adjust_left = FALSE; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1313 maxwidth = wp->w_maxwidth; |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1314 } |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1315 |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1316 if (wp->w_p_nu || wp->w_p_rnu) |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1317 margin_width = number_width(wp) + 1; |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1318 #ifdef FEAT_FOLDING |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1319 margin_width += wp->w_p_fdc; |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1320 #endif |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1321 #ifdef FEAT_SIGNS |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1322 if (signcolumn_on(wp)) |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1323 margin_width += 2; |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1324 #endif |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1325 if (margin_width >= maxwidth) |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1326 margin_width = maxwidth - 1; |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1327 |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1328 minwidth = wp->w_minwidth; |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1329 minheight = wp->w_minheight; |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1330 #ifdef FEAT_TERMINAL |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1331 // A terminal popup initially does not have content, use a default minimal |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1332 // width of 20 characters and height of 5 lines. |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1333 if (wp->w_buffer->b_term != NULL) |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1334 { |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1335 if (minwidth == 0) |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1336 minwidth = 20; |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1337 if (minheight == 0) |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1338 minheight = 5; |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1339 } |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1340 #endif |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1341 |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1342 if (wp->w_maxheight > 0) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1343 maxheight = wp->w_maxheight; |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1344 |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1345 // start at the desired first line |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1346 if (wp->w_firstline > 0) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1347 wp->w_topline = wp->w_firstline; |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1348 if (wp->w_topline < 1) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1349 wp->w_topline = 1; |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
1350 else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count) |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1351 wp->w_topline = wp->w_buffer->b_ml.ml_line_count; |
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1352 |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1353 // Compute width based on longest text line and the 'wrap' option. |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1354 // Use a minimum width of one, so that something shows when there is no |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1355 // text. |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1356 // When "firstline" is -1 then start with the last buffer line and go |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1357 // backwards. |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1358 // TODO: more accurate wrapping |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1359 wp->w_width = 1; |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1360 if (wp->w_firstline < 0) |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1361 lnum = wp->w_buffer->b_ml.ml_line_count; |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1362 else |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1363 lnum = wp->w_topline; |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1364 while (lnum >= 1 && lnum <= wp->w_buffer->b_ml.ml_line_count) |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1365 { |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1366 int len; |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1367 int w_width = wp->w_width; |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1368 |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1369 // Count Tabs for what they are worth and compute the length based on |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1370 // the maximum width (matters when 'showbreak' is set). |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1371 // "margin_width" is added to "len" where it matters. |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1372 if (wp->w_width < maxwidth) |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1373 wp->w_width = maxwidth; |
29451
057c26b5c33a
patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1374 len = win_linetabsize(wp, lnum, ml_get_buf(wp->w_buffer, lnum, FALSE), |
17314
b60402471f69
patch 8.1.1656: popup window width is wrong when using Tabs
Bram Moolenaar <Bram@vim.org>
parents:
17300
diff
changeset
|
1375 (colnr_T)MAXCOL); |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17440
diff
changeset
|
1376 wp->w_width = w_width; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1377 |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1378 if (wp->w_p_wrap) |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1379 { |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1380 while (len + margin_width > maxwidth) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1381 { |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1382 ++wrapped; |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1383 len -= maxwidth - margin_width; |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1384 wp->w_width = maxwidth; |
18339
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18239
diff
changeset
|
1385 used_maxwidth = TRUE; |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1386 } |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1387 } |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1388 else if (len + margin_width > maxwidth |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1389 && allow_adjust_left |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1390 && (wp->w_popup_pos == POPPOS_TOPLEFT |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1391 || wp->w_popup_pos == POPPOS_BOTLEFT)) |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1392 { |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1393 // adjust leftwise to fit text on screen |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1394 int shift_by = len + margin_width - maxwidth; |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1395 |
17101
1a23650f8da5
patch 8.1.1550: when a popup has left padding text may be cut off
Bram Moolenaar <Bram@vim.org>
parents:
17097
diff
changeset
|
1396 if (shift_by > wp->w_wincol) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1397 { |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1398 int truncate_shift = shift_by - wp->w_wincol; |
17101
1a23650f8da5
patch 8.1.1550: when a popup has left padding text may be cut off
Bram Moolenaar <Bram@vim.org>
parents:
17097
diff
changeset
|
1399 |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1400 len -= truncate_shift; |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1401 shift_by -= truncate_shift; |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1402 } |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1403 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1404 wp->w_wincol -= shift_by; |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1405 maxwidth += shift_by; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1406 wp->w_width = maxwidth; |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1407 } |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1408 if (wp->w_width < len + margin_width) |
17354
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
1409 { |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
1410 wp->w_width = len + margin_width; |
17354
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
1411 if (wp->w_maxwidth > 0 && wp->w_width > wp->w_maxwidth) |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
1412 wp->w_width = wp->w_maxwidth; |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
1413 } |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1414 |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1415 if (wp->w_firstline < 0) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1416 --lnum; |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1417 else |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1418 ++lnum; |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1419 |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1420 // do not use the width of lines we're not going to show |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1421 if (maxheight > 0 |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1422 && (wp->w_firstline >= 0 |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1423 ? lnum - wp->w_topline |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1424 : wp->w_buffer->b_ml.ml_line_count - lnum) |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1425 + wrapped >= maxheight) |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1426 break; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1427 } |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1428 |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1429 if (wp->w_firstline < 0) |
28550
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
1430 wp->w_topline = lnum + 1; |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
1431 |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
1432 wp->w_has_scrollbar = wp->w_want_scrollbar |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
1433 && (wp->w_topline > 1 || lnum <= wp->w_buffer->b_ml.ml_line_count); |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
1434 #ifdef FEAT_TERMINAL |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
1435 if (wp->w_buffer->b_term != NULL && !term_is_finished(wp->w_buffer)) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
1436 // Terminal window with running job never has a scrollbar, adjusts to |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
1437 // window height. |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
1438 wp->w_has_scrollbar = FALSE; |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
1439 #endif |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1440 maxwidth_no_scrollbar = maxwidth; |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1441 if (wp->w_has_scrollbar) |
17821
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
1442 { |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1443 ++right_extra; |
17821
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
1444 ++extra_width; |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1445 // make space for the scrollbar if needed, when lines wrap and when |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1446 // applying minwidth |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1447 if (maxwidth + right_extra >= maxspace |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1448 && (used_maxwidth || (minwidth > 0 && wp->w_width < minwidth))) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18438
diff
changeset
|
1449 maxwidth -= wp->w_popup_padding[1] + 1; |
17821
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
1450 } |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
1451 |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1452 if (wp->w_popup_title != NULL && *wp->w_popup_title != NUL) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1453 { |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1454 int title_len = vim_strsize(wp->w_popup_title) + 2 - extra_width; |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1455 |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1456 if (minwidth < title_len) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1457 minwidth = title_len; |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1458 } |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1459 |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1460 if (minwidth > 0 && wp->w_width < minwidth) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1461 wp->w_width = minwidth; |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
1462 if (wp->w_width > maxwidth) |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1463 { |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1464 if (wp->w_width > maxspace && !wp->w_p_wrap) |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1465 // some columns cut off on the right |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1466 wp->w_popup_rightoff = wp->w_width - maxspace; |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1467 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1468 // If the window doesn't fit because 'minwidth' is set then the |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1469 // scrollbar is at the far right of the screen, use the size without |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1470 // the scrollbar. |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1471 if (wp->w_has_scrollbar && wp->w_minwidth > 0) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1472 { |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1473 int off = wp->w_width - maxwidth; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1474 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1475 if (off > right_extra) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1476 extra_width -= right_extra; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1477 else |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1478 extra_width -= off; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1479 wp->w_width = maxwidth_no_scrollbar; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1480 } |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1481 else |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1482 { |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1483 wp->w_width = maxwidth; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1484 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1485 // when adding a scrollbar below need to adjust the width |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1486 width_with_scrollbar = maxwidth_no_scrollbar - right_extra; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1487 } |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1488 } |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1489 if (center_hor) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1490 { |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1491 wp->w_wincol = (Columns - wp->w_width - extra_width) / 2; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1492 if (wp->w_wincol < 0) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1493 wp->w_wincol = 0; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1494 } |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1495 else if (wp->w_popup_pos == POPPOS_BOTRIGHT |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1496 || wp->w_popup_pos == POPPOS_TOPRIGHT) |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1497 { |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1498 int leftoff = wantcol - (wp->w_width + extra_width); |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1499 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1500 // Right aligned: move to the right if needed. |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1501 // No truncation, because that would change the height. |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1502 if (leftoff >= 0) |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1503 wp->w_wincol = leftoff; |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1504 else if (wp->w_popup_fixed) |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1505 { |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1506 // "col" specifies the right edge, but popup doesn't fit, skip some |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1507 // columns when displaying the window, minus left border and |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1508 // padding. |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1509 if (-leftoff > left_extra) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1510 wp->w_leftcol = -leftoff - left_extra; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1511 wp->w_width -= wp->w_leftcol; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1512 wp->w_popup_leftoff = -leftoff; |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1513 if (wp->w_width < 0) |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1514 wp->w_width = 0; |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1515 } |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1516 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1517 |
17563
cc2c4179427c
patch 8.1.1779: not showing the popup window right border is confusing
Bram Moolenaar <Bram@vim.org>
parents:
17561
diff
changeset
|
1518 if (wp->w_p_wrap || (!wp->w_popup_fixed |
cc2c4179427c
patch 8.1.1779: not showing the popup window right border is confusing
Bram Moolenaar <Bram@vim.org>
parents:
17561
diff
changeset
|
1519 && (wp->w_popup_pos == POPPOS_TOPLEFT |
cc2c4179427c
patch 8.1.1779: not showing the popup window right border is confusing
Bram Moolenaar <Bram@vim.org>
parents:
17561
diff
changeset
|
1520 || wp->w_popup_pos == POPPOS_BOTLEFT))) |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1521 { |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1522 int want_col = 0; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1523 |
17561
724370d05e79
patch 8.1.1778: not showing the popup window right border is confusing
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
1524 // try to show the right border and any scrollbar |
724370d05e79
patch 8.1.1778: not showing the popup window right border is confusing
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
1525 want_col = left_extra + wp->w_width + right_extra; |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1526 if (want_col > 0 && wp->w_wincol > 0 |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1527 && wp->w_wincol + want_col >= Columns) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1528 { |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1529 wp->w_wincol = Columns - want_col; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1530 if (wp->w_wincol < 0) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1531 wp->w_wincol = 0; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1532 } |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1533 } |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1534 |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1535 wp->w_height = wp->w_buffer->b_ml.ml_line_count - wp->w_topline |
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
1536 + 1 + wrapped; |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1537 if (minheight > 0 && wp->w_height < minheight) |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19637
diff
changeset
|
1538 wp->w_height = minheight; |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1539 if (maxheight > 0 && wp->w_height > maxheight) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1540 wp->w_height = maxheight; |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1541 w_height_before_limit = wp->w_height; |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1542 if (wp->w_height > Rows - wp->w_winrow) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1543 wp->w_height = Rows - wp->w_winrow; |
16839
032d5335987e
patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16837
diff
changeset
|
1544 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1545 if (center_vert) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1546 { |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1547 wp->w_winrow = (Rows - wp->w_height - extra_height) / 2; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1548 if (wp->w_winrow < 0) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1549 wp->w_winrow = 0; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1550 } |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1551 else if (wp->w_popup_pos == POPPOS_BOTRIGHT |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1552 || wp->w_popup_pos == POPPOS_BOTLEFT) |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1553 { |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1554 if ((wp->w_height + extra_height) <= wantline) |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1555 // bottom aligned: may move down |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1556 wp->w_winrow = wantline - (wp->w_height + extra_height); |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1557 else if (wantline * 2 >= Rows || !(wp->w_popup_flags & POPF_POSINVERT)) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1558 { |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1559 // Bottom aligned but does not fit, and less space on the other |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1560 // side or "posinvert" is off: reduce height. |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1561 wp->w_winrow = 0; |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1562 wp->w_height = wantline - extra_height; |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1563 } |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1564 else |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1565 { |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1566 // Not enough space and more space on the other side: make top |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1567 // aligned. |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
1568 wp->w_winrow = (wantline < 0 ? 0 : wantline) + 1; |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1569 adjust_height_for_top_aligned = TRUE; |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1570 } |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1571 } |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1572 else if (wp->w_popup_pos == POPPOS_TOPRIGHT |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1573 || wp->w_popup_pos == POPPOS_TOPLEFT) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1574 { |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1575 if (wp != popup_dragwin |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1576 && wantline + (wp->w_height + extra_height) - 1 > Rows |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1577 && wantline * 2 > Rows |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1578 && (wp->w_popup_flags & POPF_POSINVERT)) |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1579 { |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1580 // top aligned and not enough space below but there is space above: |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1581 // make bottom aligned and recompute the height |
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1582 wp->w_height = w_height_before_limit; |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1583 wp->w_winrow = wantline - 2 - wp->w_height - extra_height; |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1584 if (wp->w_winrow < 0) |
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1585 { |
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1586 wp->w_height += wp->w_winrow; |
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1587 wp->w_winrow = 0; |
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1588 } |
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18584
diff
changeset
|
1589 } |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1590 else |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1591 { |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1592 wp->w_winrow = wantline - 1; |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1593 adjust_height_for_top_aligned = TRUE; |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1594 } |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
1595 } |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1596 |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1597 if (adjust_height_for_top_aligned && wp->w_want_scrollbar |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1598 && wp->w_winrow + wp->w_height + extra_height > Rows) |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1599 { |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1600 // Bottom of the popup goes below the last line, reduce the height and |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1601 // add a scrollbar. |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1602 wp->w_height = Rows - wp->w_winrow - extra_height; |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1603 #ifdef FEAT_TERMINAL |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
1604 if (wp->w_buffer->b_term == NULL || term_is_finished(wp->w_buffer)) |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1605 #endif |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1606 { |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1607 wp->w_has_scrollbar = TRUE; |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1608 if (width_with_scrollbar > 0) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1609 wp->w_width = width_with_scrollbar; |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
1610 } |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1611 } |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1612 |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
1613 // make sure w_winrow is valid |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1614 if (wp->w_winrow >= Rows) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1615 wp->w_winrow = Rows - 1; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1616 else if (wp->w_winrow < 0) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1617 wp->w_winrow = 0; |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1618 |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1619 if (wp->w_height != org_height) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1620 win_comp_scroll(wp); |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
1621 |
16839
032d5335987e
patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16837
diff
changeset
|
1622 wp->w_popup_last_changedtick = CHANGEDTICK(wp->w_buffer); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1623 if (win_valid(wp->w_popup_prop_win)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1624 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1625 wp->w_popup_prop_changedtick = |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1626 CHANGEDTICK(wp->w_popup_prop_win->w_buffer); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1627 wp->w_popup_prop_topline = wp->w_popup_prop_win->w_topline; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
1628 } |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1629 |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1630 // Need to update popup_mask if the position or size changed. |
17841
9513821d9d8f
patch 8.1.1917: non-current window is not redrawn when moving popup
Bram Moolenaar <Bram@vim.org>
parents:
17823
diff
changeset
|
1631 // And redraw windows and statuslines that were behind the popup. |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1632 if (org_winrow != wp->w_winrow |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1633 || org_wincol != wp->w_wincol |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
1634 || org_leftcol != wp->w_leftcol |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
1635 || org_leftoff != wp->w_popup_leftoff |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1636 || org_width != wp->w_width |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1637 || org_height != wp->w_height) |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1638 { |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
1639 redraw_win_later(wp, UPD_NOT_VALID); |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1640 if (wp->w_popup_flags & POPF_ON_CMDLINE) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1641 clear_cmdline = TRUE; |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1642 popup_mask_refresh = TRUE; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
1643 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1644 } |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1645 |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
1646 typedef enum |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
1647 { |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
1648 TYPE_NORMAL, |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
1649 TYPE_ATCURSOR, |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
1650 TYPE_BEVAL, |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
1651 TYPE_NOTIFICATION, |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1652 TYPE_DIALOG, |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1653 TYPE_MENU, |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1654 TYPE_PREVIEW, // preview window |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1655 TYPE_INFO // popup menu info |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
1656 } create_type_T; |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
1657 |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
1658 /* |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1659 * Make "buf" empty and set the contents to "text". |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1660 * Used by popup_create() and popup_settext(). |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1661 */ |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1662 static void |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1663 popup_set_buffer_text(buf_T *buf, typval_T text) |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1664 { |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1665 int lnum; |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1666 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1667 // Clear the buffer, then replace the lines. |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1668 curbuf = buf; |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1669 for (lnum = buf->b_ml.ml_line_count; lnum > 0; --lnum) |
20599
d571231175b4
patch 8.2.0853: ml_delete() often called with FALSE argument
Bram Moolenaar <Bram@vim.org>
parents:
20476
diff
changeset
|
1670 ml_delete(lnum); |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1671 curbuf = curwin->w_buffer; |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1672 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1673 // Add text to the buffer. |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1674 if (text.v_type == VAR_STRING) |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1675 { |
22600
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22429
diff
changeset
|
1676 char_u *s = text.vval.v_string; |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22429
diff
changeset
|
1677 |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1678 // just a string |
22600
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22429
diff
changeset
|
1679 ml_append_buf(buf, 0, s == NULL ? (char_u *)"" : s, (colnr_T)0, TRUE); |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1680 } |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1681 else |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1682 { |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1683 list_T *l = text.vval.v_list; |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1684 |
22600
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22429
diff
changeset
|
1685 if (l != NULL && l->lv_len > 0) |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1686 { |
29034
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1687 if (l->lv_first == &range_list_item) |
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1688 emsg(_(e_using_number_as_string)); |
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1689 else if (l->lv_first->li_tv.v_type == VAR_STRING) |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1690 // list of strings |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1691 add_popup_strings(buf, l); |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1692 else |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1693 // list of dictionaries |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1694 add_popup_dicts(buf, l); |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1695 } |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1696 } |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1697 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1698 // delete the line that was in the empty buffer |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1699 curbuf = buf; |
20599
d571231175b4
patch 8.2.0853: ml_delete() often called with FALSE argument
Bram Moolenaar <Bram@vim.org>
parents:
20476
diff
changeset
|
1700 ml_delete(buf->b_ml.ml_line_count); |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1701 curbuf = curwin->w_buffer; |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1702 } |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1703 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
1704 /* |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1705 * Parse the 'previewpopup' or 'completepopup' option and apply the values to |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1706 * window "wp" if it is not NULL. |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1707 * Return FAIL if the parsing fails. |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1708 */ |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1709 static int |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1710 parse_popup_option(win_T *wp, int is_preview) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1711 { |
17791
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1712 char_u *p = |
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1713 #ifdef FEAT_QUICKFIX |
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1714 !is_preview ? p_cpp : |
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1715 #endif |
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1716 p_pvp; |
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1717 |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1718 if (wp != NULL) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1719 wp->w_popup_flags &= ~POPF_INFO_MENU; |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1720 |
17791
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
1721 for ( ; *p != NUL; p += (*p == ',' ? 1 : 0)) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1722 { |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1723 char_u *e, *dig; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1724 char_u *s = p; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1725 int x; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1726 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1727 e = vim_strchr(p, ':'); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1728 if (e == NULL || e[1] == NUL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1729 return FAIL; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1730 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1731 p = vim_strchr(e, ','); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1732 if (p == NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1733 p = e + STRLEN(e); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1734 dig = e + 1; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1735 x = getdigits(&dig); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1736 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1737 if (STRNCMP(s, "height:", 7) == 0) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1738 { |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1739 if (dig != p) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1740 return FAIL; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1741 if (wp != NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1742 { |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1743 if (is_preview) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1744 wp->w_minheight = x; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1745 wp->w_maxheight = x; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1746 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1747 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1748 else if (STRNCMP(s, "width:", 6) == 0) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1749 { |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1750 if (dig != p) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1751 return FAIL; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1752 if (wp != NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1753 { |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1754 if (is_preview) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1755 wp->w_minwidth = x; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1756 wp->w_maxwidth = x; |
21377
47f25a0c5a42
patch 8.2.1239: "maxwidth" in 'completepopup' not obeyed
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
1757 wp->w_maxwidth_opt = x; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1758 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1759 } |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1760 else if (STRNCMP(s, "highlight:", 10) == 0) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1761 { |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1762 if (wp != NULL) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1763 { |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1764 int c = *p; |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1765 |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1766 *p = NUL; |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1767 set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1, |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1768 s + 10, OPT_FREE|OPT_LOCAL, 0); |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1769 *p = c; |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1770 } |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1771 } |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1772 else if (STRNCMP(s, "border:", 7) == 0) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1773 { |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1774 char_u *arg = s + 7; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1775 int on = STRNCMP(arg, "on", 2) == 0 && arg + 2 == p; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1776 int off = STRNCMP(arg, "off", 3) == 0 && arg + 3 == p; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1777 int i; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1778 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1779 if (!on && !off) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1780 return FAIL; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1781 if (wp != NULL) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1782 { |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1783 for (i = 0; i < 4; ++i) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1784 wp->w_popup_border[i] = on ? 1 : 0; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1785 if (off) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1786 // only show the X for close when there is a border |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1787 wp->w_popup_close = POPCLOSE_NONE; |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1788 } |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17791
diff
changeset
|
1789 } |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1790 else if (STRNCMP(s, "align:", 6) == 0) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1791 { |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1792 char_u *arg = s + 6; |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1793 int item = STRNCMP(arg, "item", 4) == 0 && arg + 4 == p; |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1794 int menu = STRNCMP(arg, "menu", 4) == 0 && arg + 4 == p; |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1795 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1796 if (!menu && !item) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1797 return FAIL; |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1798 if (wp != NULL && menu) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1799 wp->w_popup_flags |= POPF_INFO_MENU; |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
1800 } |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1801 else |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1802 return FAIL; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1803 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1804 return OK; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1805 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1806 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1807 /* |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1808 * Parse the 'previewpopup' option and apply the values to window "wp" if it |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1809 * is not NULL. |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1810 * Return FAIL if the parsing fails. |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1811 */ |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1812 int |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1813 parse_previewpopup(win_T *wp) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1814 { |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1815 return parse_popup_option(wp, TRUE); |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1816 } |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1817 |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1818 /* |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1819 * Parse the 'completepopup' option and apply the values to window "wp" if it |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1820 * is not NULL. |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1821 * Return FAIL if the parsing fails. |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1822 */ |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1823 int |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1824 parse_completepopup(win_T *wp) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1825 { |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1826 return parse_popup_option(wp, FALSE); |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1827 } |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1828 |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
1829 /* |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1830 * Set w_wantline and w_wantcol for the cursor position in the current window. |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1831 * Keep at least "width" columns from the right of the screen. |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1832 */ |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1833 void |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1834 popup_set_wantpos_cursor(win_T *wp, int width, dict_T *d) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1835 { |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1836 poppos_T ppt = POPPOS_NONE; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1837 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1838 if (d != NULL) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1839 ppt = get_pos_entry(d, FALSE); |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1840 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1841 setcursor_mayforce(TRUE); |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1842 if (ppt == POPPOS_TOPRIGHT || ppt == POPPOS_TOPLEFT) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1843 { |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1844 wp->w_wantline = curwin->w_winrow + curwin->w_wrow + 2; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1845 } |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1846 else |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1847 { |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1848 wp->w_wantline = curwin->w_winrow + curwin->w_wrow; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1849 if (wp->w_wantline == 0) // cursor in first line |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1850 { |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1851 wp->w_wantline = 2; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1852 wp->w_popup_pos = ppt == POPPOS_BOTRIGHT |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1853 ? POPPOS_TOPRIGHT : POPPOS_TOPLEFT; |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1854 } |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1855 } |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1856 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1857 wp->w_wantcol = curwin->w_wincol + curwin->w_wcol + 1; |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1858 if (wp->w_wantcol > Columns - width) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1859 { |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1860 wp->w_wantcol = Columns - width; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1861 if (wp->w_wantcol < 1) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1862 wp->w_wantcol = 1; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
1863 } |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1864 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1865 popup_adjust_position(wp); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1866 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1867 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1868 /* |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1869 * Set w_wantline and w_wantcol for the a given screen position. |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1870 * Caller must take care of running into the window border. |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1871 */ |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1872 void |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1873 popup_set_wantpos_rowcol(win_T *wp, int row, int col) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1874 { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1875 wp->w_wantline = row; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1876 wp->w_wantcol = col; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1877 popup_adjust_position(wp); |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1878 } |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1879 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1880 /* |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1881 * Add a border and lef&right padding. |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1882 */ |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1883 static void |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1884 add_border_left_right_padding(win_T *wp) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1885 { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1886 int i; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1887 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1888 for (i = 0; i < 4; ++i) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1889 { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1890 wp->w_popup_border[i] = 1; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1891 wp->w_popup_padding[i] = (i & 1) ? 1 : 0; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1892 } |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1893 } |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1894 |
20476
77995c0a9e78
patch 8.2.0792: build failure with small features
Bram Moolenaar <Bram@vim.org>
parents:
20474
diff
changeset
|
1895 #ifdef FEAT_TERMINAL |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1896 /* |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1897 * Return TRUE if there is any popup window with a terminal buffer. |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1898 */ |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1899 static int |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1900 popup_terminal_exists(void) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1901 { |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1902 win_T *wp; |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1903 tabpage_T *tp; |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1904 |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1905 FOR_ALL_POPUPWINS(wp) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1906 if (wp->w_buffer->b_term != NULL) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1907 return TRUE; |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1908 FOR_ALL_TABPAGES(tp) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1909 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1910 if (wp->w_buffer->b_term != NULL) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1911 return TRUE; |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1912 return FALSE; |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1913 } |
20476
77995c0a9e78
patch 8.2.0792: build failure with small features
Bram Moolenaar <Bram@vim.org>
parents:
20474
diff
changeset
|
1914 #endif |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1915 |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1916 /* |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1917 * popup_create({text}, {options}) |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
1918 * popup_atcursor({text}, {options}) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1919 * etc. |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
1920 * When creating a preview or info popup "argvars" and "rettv" are NULL. |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1921 */ |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1922 static win_T * |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
1923 popup_create(typval_T *argvars, typval_T *rettv, create_type_T type) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1924 { |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1925 win_T *wp; |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1926 tabpage_T *tp = NULL; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1927 int tabnr = 0; |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
1928 int new_buffer; |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
1929 buf_T *buf = NULL; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1930 dict_T *d = NULL; |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1931 int nr; |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1932 int i; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1933 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1934 if (argvars != NULL) |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
1935 { |
26127
80e69293217c
patch 8.2.3596: crash when using :pedit in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
1936 if (in_vim9script() |
80e69293217c
patch 8.2.3596: crash when using :pedit in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
1937 && (check_for_string_or_number_or_list_arg(argvars, 0) == FAIL |
80e69293217c
patch 8.2.3596: crash when using :pedit in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
1938 || check_for_dict_arg(argvars, 1) == FAIL)) |
80e69293217c
patch 8.2.3596: crash when using :pedit in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
1939 return NULL; |
80e69293217c
patch 8.2.3596: crash when using :pedit in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
1940 |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
1941 // Check that arguments look OK. |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1942 if (argvars[0].v_type == VAR_NUMBER) |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
1943 { |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1944 buf = buflist_findnr(argvars[0].vval.v_number); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1945 if (buf == NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1946 { |
26439
b18f3b0f317c
patch 8.2.3750: error messages are everywhere
Bram Moolenaar <Bram@vim.org>
parents:
26332
diff
changeset
|
1947 semsg(_(e_buffer_nr_does_not_exist), argvars[0].vval.v_number); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1948 return NULL; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1949 } |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1950 #ifdef FEAT_TERMINAL |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1951 if (buf->b_term != NULL && popup_terminal_exists()) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1952 { |
26962
85866e069c24
patch 8.2.4010: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26915
diff
changeset
|
1953 emsg(_(e_cannot_open_second_popup_with_terminal)); |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1954 return NULL; |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1955 } |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1956 #endif |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1957 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1958 else if (!(argvars[0].v_type == VAR_STRING |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1959 && argvars[0].vval.v_string != NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1960 && !(argvars[0].v_type == VAR_LIST |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1961 && argvars[0].vval.v_list != NULL)) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1962 { |
26915
3631d2deb36c
patch 8.2.3986: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1963 emsg(_(e_buffer_number_text_or_list_required)); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
1964 return NULL; |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
1965 } |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1966 if (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1967 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
1968 emsg(_(e_dictionary_required)); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1969 return NULL; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1970 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1971 d = argvars[1].vval.v_dict; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1972 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1973 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1974 if (d != NULL) |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1975 { |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
28285
diff
changeset
|
1976 if (dict_has_key(d, "tabpage")) |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29239
diff
changeset
|
1977 tabnr = (int)dict_get_number(d, "tabpage"); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1978 else if (type == TYPE_NOTIFICATION) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1979 tabnr = -1; // notifications are global by default |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1980 else |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1981 tabnr = 0; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1982 if (tabnr > 0) |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1983 { |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1984 tp = find_tabpage(tabnr); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1985 if (tp == NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1986 { |
26986
79ea140936e9
patch 8.2.4022: two error messages in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
26962
diff
changeset
|
1987 semsg(_(e_tabpage_not_found_nr), tabnr); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1988 return NULL; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1989 } |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1990 } |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1991 } |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
1992 |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1993 // Create the window and buffer. |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1994 wp = win_alloc_popup_win(); |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1995 if (wp == NULL) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
1996 return NULL; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1997 if (rettv != NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1998 rettv->vval.v_number = wp->w_id; |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1999 wp->w_popup_pos = POPPOS_TOPLEFT; |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
2000 wp->w_popup_flags = POPF_IS_POPUP | POPF_MAPPING | POPF_POSINVERT; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2001 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2002 if (buf != NULL) |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2003 { |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2004 // use existing buffer |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2005 new_buffer = FALSE; |
17231
e9ebf3f27af6
patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
2006 win_init_popup_win(wp, buf); |
17845
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17843
diff
changeset
|
2007 set_local_options_default(wp, FALSE); |
28319
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28315
diff
changeset
|
2008 swap_exists_action = SEA_READONLY; |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2009 buffer_ensure_loaded(buf); |
28319
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28315
diff
changeset
|
2010 swap_exists_action = SEA_NONE; |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2011 } |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2012 else |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2013 { |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2014 // create a new buffer associated with the popup |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2015 new_buffer = TRUE; |
17823
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
2016 buf = buflist_new(NULL, NULL, (linenr_T)0, BLN_NEW|BLN_DUMMY|BLN_REUSE); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2017 if (buf == NULL) |
28285
a4aad5142959
patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2018 { |
a4aad5142959
patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2019 win_free_popup(wp); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2020 return NULL; |
28285
a4aad5142959
patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2021 } |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2022 ml_open(buf); |
16843
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
2023 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2024 win_init_popup_win(wp, buf); |
16843
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
2025 |
17845
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17843
diff
changeset
|
2026 set_local_options_default(wp, TRUE); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2027 set_string_option_direct_in_buf(buf, (char_u *)"buftype", -1, |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2028 (char_u *)"popup", OPT_FREE|OPT_LOCAL, 0); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2029 set_string_option_direct_in_buf(buf, (char_u *)"bufhidden", -1, |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2030 (char_u *)"wipe", OPT_FREE|OPT_LOCAL, 0); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2031 buf->b_p_ul = -1; // no undo |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2032 buf->b_p_swf = FALSE; // no swap file |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2033 buf->b_p_bl = FALSE; // unlisted buffer |
23869
5a4f9c5c1b99
patch 8.2.2476: using freed memory when splitting window while closing buffer
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
2034 buf->b_locked = TRUE; // prevent deleting the buffer |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
2035 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2036 // Avoid that 'buftype' is reset when this buffer is entered. |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2037 buf->b_p_initialized = TRUE; |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2038 } |
17926
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17905
diff
changeset
|
2039 wp->w_p_wrap = TRUE; // 'wrap' is default on |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17905
diff
changeset
|
2040 wp->w_p_so = 0; // 'scrolloff' zero |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2041 |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2042 if (tp != NULL) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2043 { |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2044 // popup on specified tab page |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2045 wp->w_next = tp->tp_first_popupwin; |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2046 tp->tp_first_popupwin = wp; |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2047 } |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2048 else if (tabnr == 0) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2049 { |
17075
dacd46fbaa90
patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents:
17057
diff
changeset
|
2050 // popup on current tab page |
16796
5f98d80d116a
patch 8.1.1400: using global pointer for tab-local popups is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
2051 wp->w_next = curtab->tp_first_popupwin; |
5f98d80d116a
patch 8.1.1400: using global pointer for tab-local popups is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
2052 curtab->tp_first_popupwin = wp; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2053 } |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
2054 else // (tabnr < 0) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2055 { |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2056 win_T *prev = first_popupwin; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2057 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2058 // Global popup: add at the end, so that it gets displayed on top of |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2059 // older ones with the same zindex. Matters for notifications. |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2060 if (first_popupwin == NULL) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2061 first_popupwin = wp; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2062 else |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2063 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2064 while (prev->w_next != NULL) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2065 prev = prev->w_next; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2066 prev->w_next = wp; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2067 } |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2069 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2070 if (new_buffer && argvars != NULL) |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2071 popup_set_buffer_text(buf, argvars[0]); |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2072 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2073 if (type == TYPE_ATCURSOR || type == TYPE_PREVIEW) |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2074 { |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2075 wp->w_popup_pos = POPPOS_BOTLEFT; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2076 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2077 if (type == TYPE_ATCURSOR) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2078 { |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
2079 popup_set_wantpos_cursor(wp, 0, d); |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2080 set_moved_values(wp); |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2081 set_moved_columns(wp, FIND_STRING); |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2082 } |
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2083 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2084 if (type == TYPE_BEVAL) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2085 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2086 wp->w_popup_pos = POPPOS_BOTLEFT; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2087 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2088 // by default use the mouse position |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2089 wp->w_wantline = mouse_row; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2090 if (wp->w_wantline <= 0) // mouse on first line |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2091 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2092 wp->w_wantline = 2; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2093 wp->w_popup_pos = POPPOS_TOPLEFT; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2094 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2095 wp->w_wantcol = mouse_col + 1; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2096 set_mousemoved_values(wp); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2097 set_mousemoved_columns(wp, FIND_IDENT + FIND_STRING + FIND_EVAL); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2098 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2099 |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
2100 // set default values |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
2101 wp->w_zindex = POPUPWIN_DEFAULT_ZINDEX; |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2102 wp->w_popup_close = POPCLOSE_NONE; |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
2103 |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2104 if (type == TYPE_NOTIFICATION) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2105 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2106 win_T *twp, *nextwin; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2107 int height = buf->b_ml.ml_line_count + 3; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2108 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2109 // Try to not overlap with another global popup. Guess we need 3 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2110 // more screen lines than buffer lines. |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2111 wp->w_wantline = 1; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2112 for (twp = first_popupwin; twp != NULL; twp = nextwin) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2113 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2114 nextwin = twp->w_next; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2115 if (twp != wp |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2116 && twp->w_zindex == POPUPWIN_NOTIFICATION_ZINDEX |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2117 && twp->w_winrow <= wp->w_wantline - 1 + height |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2118 && twp->w_winrow + popup_height(twp) > wp->w_wantline - 1) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2119 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2120 // move to below this popup and restart the loop to check for |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2121 // overlap with other popups |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2122 wp->w_wantline = twp->w_winrow + popup_height(twp) + 1; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2123 nextwin = first_popupwin; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2124 } |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2125 } |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2126 if (wp->w_wantline + height > Rows) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2127 { |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2128 // can't avoid overlap, put on top in the hope that message goes |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2129 // away soon. |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2130 wp->w_wantline = 1; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2131 } |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2132 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2133 wp->w_wantcol = 10; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2134 wp->w_zindex = POPUPWIN_NOTIFICATION_ZINDEX; |
17077
2546930657a9
patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents:
17075
diff
changeset
|
2135 wp->w_minwidth = 20; |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
2136 wp->w_popup_flags |= POPF_DRAG; |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2137 wp->w_popup_close = POPCLOSE_CLICK; |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2138 for (i = 0; i < 4; ++i) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2139 wp->w_popup_border[i] = 1; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2140 wp->w_popup_padding[1] = 1; |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2141 wp->w_popup_padding[3] = 1; |
17077
2546930657a9
patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents:
17075
diff
changeset
|
2142 |
2546930657a9
patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents:
17075
diff
changeset
|
2143 nr = syn_name2id((char_u *)"PopupNotification"); |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2144 set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1, |
17077
2546930657a9
patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents:
17075
diff
changeset
|
2145 (char_u *)(nr == 0 ? "WarningMsg" : "PopupNotification"), |
2546930657a9
patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents:
17075
diff
changeset
|
2146 OPT_FREE|OPT_LOCAL, 0); |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2147 } |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2148 |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2149 if (type == TYPE_DIALOG || type == TYPE_MENU) |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2150 { |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2151 wp->w_popup_pos = POPPOS_CENTER; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2152 wp->w_zindex = POPUPWIN_DIALOG_ZINDEX; |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
2153 wp->w_popup_flags |= POPF_DRAG; |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
2154 wp->w_popup_flags &= ~POPF_MAPPING; |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2155 add_border_left_right_padding(wp); |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2156 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2157 |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2158 if (type == TYPE_MENU) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2159 { |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2160 typval_T tv; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2161 callback_T callback; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2162 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2163 tv.v_type = VAR_STRING; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2164 tv.vval.v_string = (char_u *)"popup_filter_menu"; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2165 callback = get_callback(&tv); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2166 if (callback.cb_name != NULL) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2167 set_callback(&wp->w_filter_cb, &callback); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2168 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2169 wp->w_p_wrap = 0; |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
2170 wp->w_popup_flags |= POPF_CURSORLINE; |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2171 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2172 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2173 if (type == TYPE_PREVIEW) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2174 { |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
2175 wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2176 wp->w_popup_close = POPCLOSE_BUTTON; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2177 for (i = 0; i < 4; ++i) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2178 wp->w_popup_border[i] = 1; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2179 parse_previewpopup(wp); |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
2180 popup_set_wantpos_cursor(wp, wp->w_minwidth, d); |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2181 } |
17791
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
2182 # ifdef FEAT_QUICKFIX |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2183 if (type == TYPE_INFO) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2184 { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2185 wp->w_popup_pos = POPPOS_TOPLEFT; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2186 wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2187 wp->w_popup_close = POPCLOSE_BUTTON; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
2188 add_border_left_right_padding(wp); |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17767
diff
changeset
|
2189 parse_completepopup(wp); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2190 } |
17791
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
2191 # endif |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2192 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2193 for (i = 0; i < 4; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2194 VIM_CLEAR(wp->w_border_highlight[i]); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2195 for (i = 0; i < 8; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2196 wp->w_border_char[i] = 0; |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
2197 wp->w_want_scrollbar = 1; |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
2198 wp->w_popup_fixed = 0; |
17946
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
2199 wp->w_filter_mode = MODE_ALL; |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2200 |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2201 if (d != NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
2202 // Deal with options. |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
2203 apply_options(wp, d, TRUE); |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2204 |
17166
59a4e78ccc5c
patch 8.1.1582: cannot build with +textprop but without +timers
Bram Moolenaar <Bram@vim.org>
parents:
17162
diff
changeset
|
2205 #ifdef FEAT_TIMERS |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2206 if (type == TYPE_NOTIFICATION && wp->w_popup_timer == NULL) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2207 popup_add_timeout(wp, 3000); |
17166
59a4e78ccc5c
patch 8.1.1582: cannot build with +textprop but without +timers
Bram Moolenaar <Bram@vim.org>
parents:
17162
diff
changeset
|
2208 #endif |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2209 |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2210 popup_adjust_position(wp); |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2211 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2212 wp->w_vsep_width = 0; |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2213 |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
2214 redraw_all_later(UPD_NOT_VALID); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
2215 popup_mask_refresh = TRUE; |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2216 |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
2217 #ifdef FEAT_TERMINAL |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2218 // When running a terminal in the popup it becomes the current window. |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2219 if (buf->b_term != NULL) |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2220 win_enter(wp, FALSE); |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
2221 #endif |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2222 |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2223 return wp; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2224 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2225 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2226 /* |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2227 * popup_clear() |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2228 */ |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2229 void |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2230 f_popup_clear(typval_T *argvars, typval_T *rettv UNUSED) |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2231 { |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2232 int force = FALSE; |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2233 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2234 if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2235 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2236 |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2237 if (argvars[0].v_type != VAR_UNKNOWN) |
22057
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21867
diff
changeset
|
2238 force = (int)tv_get_bool(&argvars[0]); |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2239 close_all_popups(force); |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2240 } |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2241 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16992
diff
changeset
|
2242 /* |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2243 * popup_create({text}, {options}) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2244 */ |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2245 void |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2246 f_popup_create(typval_T *argvars, typval_T *rettv) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2247 { |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2248 popup_create(argvars, rettv, TYPE_NORMAL); |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2249 } |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2250 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2251 /* |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2252 * popup_atcursor({text}, {options}) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2253 */ |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2254 void |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2255 f_popup_atcursor(typval_T *argvars, typval_T *rettv) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2256 { |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2257 popup_create(argvars, rettv, TYPE_ATCURSOR); |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2258 } |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2259 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16851
diff
changeset
|
2260 /* |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2261 * popup_beval({text}, {options}) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2262 */ |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2263 void |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2264 f_popup_beval(typval_T *argvars, typval_T *rettv) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2265 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2266 popup_create(argvars, rettv, TYPE_BEVAL); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2267 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2268 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2269 /* |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2270 * Invoke the close callback for window "wp" with value "result". |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2271 * Careful: The callback may make "wp" invalid! |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2272 */ |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2273 static void |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2274 invoke_popup_callback(win_T *wp, typval_T *result) |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2275 { |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2276 typval_T rettv; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2277 typval_T argv[3]; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2278 |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2279 argv[0].v_type = VAR_NUMBER; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2280 argv[0].vval.v_number = (varnumber_T)wp->w_id; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2281 |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2282 if (result != NULL && result->v_type != VAR_UNKNOWN) |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2283 copy_tv(result, &argv[1]); |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2284 else |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2285 { |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2286 argv[1].v_type = VAR_NUMBER; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2287 argv[1].vval.v_number = 0; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2288 } |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2289 |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2290 argv[2].v_type = VAR_UNKNOWN; |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2291 |
17606
ff097edaae89
patch 8.1.1800: function call functions have too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
17604
diff
changeset
|
2292 call_callback(&wp->w_close_cb, -1, &rettv, 2, argv); |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2293 if (result != NULL) |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2294 clear_tv(&argv[1]); |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2295 clear_tv(&rettv); |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2296 } |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2297 |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2298 /* |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2299 * Make "prevwin" the current window, unless it's equal to "wp". |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2300 * Otherwise make "firstwin" the current window. |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2301 */ |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2302 static void |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2303 back_to_prevwin(win_T *wp) |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2304 { |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2305 if (win_valid(prevwin) && wp != prevwin) |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2306 win_enter(prevwin, FALSE); |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2307 else |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2308 win_enter(firstwin, FALSE); |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2309 } |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2310 |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2311 /* |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2312 * Close popup "wp" and invoke any close callback for it. |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2313 */ |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2314 static void |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2315 popup_close_and_callback(win_T *wp, typval_T *arg) |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2316 { |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2317 int id = wp->w_id; |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2318 |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
2319 #ifdef FEAT_TERMINAL |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2320 if (wp == curwin && curbuf->b_term != NULL) |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2321 { |
19540
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2322 win_T *owp; |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2323 |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2324 // Closing popup window with a terminal: put focus back on the first |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2325 // that works: |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2326 // - another popup window with a terminal |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2327 // - the previous window |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2328 // - the first one. |
19934
3ff714d765ba
patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents:
19908
diff
changeset
|
2329 FOR_ALL_POPUPWINS(owp) |
19540
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2330 if (owp != curwin && owp->w_buffer->b_term != NULL) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2331 break; |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2332 if (owp != NULL) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2333 win_enter(owp, FALSE); |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2334 else |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2335 { |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2336 for (owp = curtab->tp_first_popupwin; owp != NULL; |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2337 owp = owp->w_next) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2338 if (owp != curwin && owp->w_buffer->b_term != NULL) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2339 break; |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2340 if (owp != NULL) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2341 win_enter(owp, FALSE); |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2342 else |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2343 back_to_prevwin(wp); |
19540
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
2344 } |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2345 } |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
2346 #endif |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2347 |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2348 // Just in case a check higher up is missing. |
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2349 if (wp == curwin && ERROR_IF_POPUP_WINDOW) |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
2350 { |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
2351 // To avoid getting stuck when win_execute() does something that causes |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
2352 // an error, stop calling the filter callback. |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
2353 free_callback(&wp->w_filter_cb); |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
2354 |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2355 return; |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
2356 } |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2357 |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2358 CHECK_CURBUF; |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2359 if (wp->w_close_cb.cb_name != NULL) |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2360 // Careful: This may make "wp" invalid. |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2361 invoke_popup_callback(wp, arg); |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2362 |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2363 popup_close(id, FALSE); |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2364 CHECK_CURBUF; |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2365 } |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2366 |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2367 void |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2368 popup_close_with_retval(win_T *wp, int retval) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2369 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2370 typval_T res; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2371 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2372 res.v_type = VAR_NUMBER; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2373 res.vval.v_number = retval; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2374 popup_close_and_callback(wp, &res); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2375 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2376 |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2377 /* |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2378 * Close popup "wp" because of a mouse click. |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2379 */ |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2380 void |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2381 popup_close_for_mouse_click(win_T *wp) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2382 { |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2383 popup_close_with_retval(wp, -2); |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2384 } |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2385 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2386 static void |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2387 check_mouse_moved(win_T *wp, win_T *mouse_wp) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2388 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2389 // Close the popup when all if these are true: |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2390 // - the mouse is not on this popup |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2391 // - "mousemoved" was used |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2392 // - the mouse is no longer on the same screen row or the mouse column is |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2393 // outside of the relevant text |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2394 if (wp != mouse_wp |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2395 && wp->w_popup_mouse_row != 0 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2396 && (wp->w_popup_mouse_row != mouse_row |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2397 || mouse_col < wp->w_popup_mouse_mincol |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2398 || mouse_col > wp->w_popup_mouse_maxcol)) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2399 { |
17300
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2400 // Careful: this makes "wp" invalid. |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2401 popup_close_with_retval(wp, -2); |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2402 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2403 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2404 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2405 /* |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2406 * Called when the mouse moved: may close a popup with "mousemoved". |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2407 */ |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2408 void |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2409 popup_handle_mouse_moved(void) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2410 { |
17300
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2411 win_T *wp, *nextwp; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2412 win_T *mouse_wp; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2413 int row = mouse_row; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2414 int col = mouse_col; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2415 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2416 // find the window where the mouse is in |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2417 mouse_wp = mouse_find_win(&row, &col, FIND_POPUP); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2418 |
17300
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2419 for (wp = first_popupwin; wp != NULL; wp = nextwp) |
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2420 { |
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2421 nextwp = wp->w_next; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2422 check_mouse_moved(wp, mouse_wp); |
17300
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2423 } |
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2424 for (wp = curtab->tp_first_popupwin; wp != NULL; wp = nextwp) |
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2425 { |
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2426 nextwp = wp->w_next; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2427 check_mouse_moved(wp, mouse_wp); |
17300
0dff534a0807
patch 8.1.1649: Illegal memory access when closing popup window
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2428 } |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2429 } |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
2430 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
2431 /* |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2432 * In a filter: check if the typed key is a mouse event that is used for |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2433 * dragging the popup. |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2434 */ |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2435 static void |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2436 filter_handle_drag(win_T *wp, int c, typval_T *rettv) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2437 { |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2438 int row = mouse_row; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2439 int col = mouse_col; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2440 |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
2441 if ((wp->w_popup_flags & (POPF_DRAG | POPF_DRAGALL)) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2442 && is_mouse_key(c) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2443 && (wp == popup_dragwin |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2444 || wp == mouse_find_win(&row, &col, FIND_POPUP))) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2445 // do not consume the key, allow for dragging the popup |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2446 rettv->vval.v_number = 0; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2447 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2448 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2449 /* |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2450 * popup_filter_menu({id}, {key}) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2451 */ |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2452 void |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2453 f_popup_filter_menu(typval_T *argvars, typval_T *rettv) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2454 { |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2455 int id; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2456 win_T *wp; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2457 char_u *key; |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2458 typval_T res; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2459 int c; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2460 linenr_T old_lnum; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2461 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2462 if (in_vim9script() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2463 && (check_for_number_arg(argvars, 0) == FAIL |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2464 || check_for_string_arg(argvars, 1) == FAIL)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2465 return; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2466 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2467 id = tv_get_number(&argvars[0]); |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2468 wp = win_id2wp(id); |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2469 key = tv_get_string(&argvars[1]); |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2470 // If the popup has been closed do not consume the key. |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2471 if (wp == NULL) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2472 return; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2473 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2474 c = *key; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2475 if (c == K_SPECIAL && key[1] != NUL) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2476 c = TO_SPECIAL(key[1], key[2]); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2477 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2478 // consume all keys until done |
22620
b5d68d8a5187
patch 8.2.1858: Vim9: filter functions return number instead of bool
Bram Moolenaar <Bram@vim.org>
parents:
22600
diff
changeset
|
2479 rettv->v_type = VAR_BOOL; |
b5d68d8a5187
patch 8.2.1858: Vim9: filter functions return number instead of bool
Bram Moolenaar <Bram@vim.org>
parents:
22600
diff
changeset
|
2480 rettv->vval.v_number = VVAL_TRUE; |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2481 res.v_type = VAR_NUMBER; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2482 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2483 old_lnum = wp->w_cursor.lnum; |
23507
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
2484 if ((c == 'k' || c == 'K' || c == K_UP || c == Ctrl_P) |
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
2485 && wp->w_cursor.lnum > 1) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2486 --wp->w_cursor.lnum; |
23507
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
2487 if ((c == 'j' || c == 'J' || c == K_DOWN || c == Ctrl_N) |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2488 && wp->w_cursor.lnum < wp->w_buffer->b_ml.ml_line_count) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2489 ++wp->w_cursor.lnum; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2490 if (old_lnum != wp->w_cursor.lnum) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2491 { |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
2492 // caller will call popup_highlight_curline() |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2493 return; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2494 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2495 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2496 if (c == 'x' || c == 'X' || c == ESC || c == Ctrl_C) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2497 { |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2498 // Cancelled, invoke callback with -1 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2499 res.vval.v_number = -1; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2500 popup_close_and_callback(wp, &res); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2501 return; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2502 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2503 if (c == ' ' || c == K_KENTER || c == CAR || c == NL) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2504 { |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2505 // Invoke callback with current index. |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2506 res.vval.v_number = wp->w_cursor.lnum; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2507 popup_close_and_callback(wp, &res); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2508 return; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2509 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2510 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2511 filter_handle_drag(wp, c, rettv); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2512 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2513 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2514 /* |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2515 * popup_filter_yesno({id}, {key}) |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2516 */ |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2517 void |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2518 f_popup_filter_yesno(typval_T *argvars, typval_T *rettv) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2519 { |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2520 int id; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2521 win_T *wp; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2522 char_u *key; |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2523 typval_T res; |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2524 int c; |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2525 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2526 if (in_vim9script() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2527 && (check_for_number_arg(argvars, 0) == FAIL |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2528 || check_for_string_arg(argvars, 1) == FAIL)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2529 return; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2530 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2531 id = tv_get_number(&argvars[0]); |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2532 wp = win_id2wp(id); |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2533 key = tv_get_string(&argvars[1]); |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2534 // If the popup has been closed don't consume the key. |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2535 if (wp == NULL) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2536 return; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2537 |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2538 c = *key; |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2539 if (c == K_SPECIAL && key[1] != NUL) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2540 c = TO_SPECIAL(key[1], key[2]); |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2541 |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2542 // consume all keys until done |
22620
b5d68d8a5187
patch 8.2.1858: Vim9: filter functions return number instead of bool
Bram Moolenaar <Bram@vim.org>
parents:
22600
diff
changeset
|
2543 rettv->v_type = VAR_BOOL; |
b5d68d8a5187
patch 8.2.1858: Vim9: filter functions return number instead of bool
Bram Moolenaar <Bram@vim.org>
parents:
22600
diff
changeset
|
2544 rettv->vval.v_number = VVAL_TRUE; |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2545 |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2546 if (c == 'y' || c == 'Y') |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2547 res.vval.v_number = 1; |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2548 else if (c == 'n' || c == 'N' || c == 'x' || c == 'X' || c == ESC) |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2549 res.vval.v_number = 0; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2550 else |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2551 { |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2552 filter_handle_drag(wp, c, rettv); |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2553 return; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2554 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2555 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2556 // Invoke callback |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2557 res.v_type = VAR_NUMBER; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2558 popup_close_and_callback(wp, &res); |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2559 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2560 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2561 /* |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2562 * popup_dialog({text}, {options}) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2563 */ |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2564 void |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2565 f_popup_dialog(typval_T *argvars, typval_T *rettv) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2566 { |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2567 popup_create(argvars, rettv, TYPE_DIALOG); |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2568 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2569 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2570 /* |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2571 * popup_menu({text}, {options}) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2572 */ |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2573 void |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2574 f_popup_menu(typval_T *argvars, typval_T *rettv) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2575 { |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
2576 popup_create(argvars, rettv, TYPE_MENU); |
17117
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2577 } |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2578 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17111
diff
changeset
|
2579 /* |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2580 * popup_notification({text}, {options}) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2581 */ |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2582 void |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2583 f_popup_notification(typval_T *argvars, typval_T *rettv) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2584 { |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2585 popup_create(argvars, rettv, TYPE_NOTIFICATION); |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2586 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2587 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2588 /* |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2589 * Find the popup window with window-ID "id". |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2590 * If the popup window does not exist NULL is returned. |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2591 * If the window is not a popup window, and error message is given. |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2592 */ |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2593 static win_T * |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2594 find_popup_win(int id) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2595 { |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2596 win_T *wp = win_id2wp(id); |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2597 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2598 if (wp != NULL && !WIN_IS_POPUP(wp)) |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2599 { |
26986
79ea140936e9
patch 8.2.4022: two error messages in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
26962
diff
changeset
|
2600 semsg(_(e_window_nr_is_not_popup_window), id); |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2601 return NULL; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2602 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2603 return wp; |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2604 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2605 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
2606 /* |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2607 * popup_close({id}) |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2608 */ |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2609 void |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2610 f_popup_close(typval_T *argvars, typval_T *rettv UNUSED) |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2611 { |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
2612 int id; |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2613 win_T *wp; |
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2614 |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
2615 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
2616 return; |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
2617 |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25338
diff
changeset
|
2618 id = (int)tv_get_number(argvars); |
19457
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19312
diff
changeset
|
2619 if ( |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19312
diff
changeset
|
2620 # ifdef FEAT_TERMINAL |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19312
diff
changeset
|
2621 // if the popup contains a terminal it will become hidden |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19312
diff
changeset
|
2622 curbuf->b_term == NULL && |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19312
diff
changeset
|
2623 # endif |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19312
diff
changeset
|
2624 ERROR_IF_ANY_POPUP_WINDOW) |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2625 return; |
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2626 |
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
2627 wp = find_popup_win(id); |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2628 if (wp != NULL) |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2629 popup_close_and_callback(wp, &argvars[1]); |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2630 } |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2631 |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
2632 void |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2633 popup_hide(win_T *wp) |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2634 { |
19312
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19293
diff
changeset
|
2635 #ifdef FEAT_TERMINAL |
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19293
diff
changeset
|
2636 if (error_if_term_popup_window()) |
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19293
diff
changeset
|
2637 return; |
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19293
diff
changeset
|
2638 #endif |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2639 if ((wp->w_popup_flags & POPF_HIDDEN) == 0) |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2640 { |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2641 wp->w_popup_flags |= POPF_HIDDEN; |
19117
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
2642 // Do not decrement b_nwindows, we still reference the buffer. |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
2643 redraw_all_later(UPD_NOT_VALID); |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2644 popup_mask_refresh = TRUE; |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2645 } |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2646 } |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2647 |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2648 /* |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2649 * popup_hide({id}) |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2650 */ |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2651 void |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2652 f_popup_hide(typval_T *argvars, typval_T *rettv UNUSED) |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2653 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2654 int id; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2655 win_T *wp; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2656 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2657 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2658 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2659 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2660 id = (int)tv_get_number(argvars); |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2661 wp = find_popup_win(id); |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2662 if (wp != NULL) |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
2663 { |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2664 popup_hide(wp); |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
2665 wp->w_popup_flags |= POPF_HIDDEN_FORCE; |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
2666 } |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2667 } |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2668 |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2669 void |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2670 popup_show(win_T *wp) |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2671 { |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2672 if ((wp->w_popup_flags & POPF_HIDDEN) != 0) |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2673 { |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2674 wp->w_popup_flags &= ~POPF_HIDDEN; |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
2675 redraw_all_later(UPD_NOT_VALID); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
2676 popup_mask_refresh = TRUE; |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2677 } |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2678 } |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2679 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2680 /* |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2681 * popup_show({id}) |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2682 */ |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2683 void |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2684 f_popup_show(typval_T *argvars, typval_T *rettv UNUSED) |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2685 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2686 int id; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2687 win_T *wp; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2688 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2689 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2690 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2691 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2692 id = (int)tv_get_number(argvars); |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2693 wp = find_popup_win(id); |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2694 if (wp != NULL) |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
2695 { |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
2696 wp->w_popup_flags &= ~POPF_HIDDEN_FORCE; |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
2697 popup_show(wp); |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2698 #ifdef FEAT_QUICKFIX |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
2699 if (wp->w_popup_flags & POPF_INFO) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
2700 pum_position_info_popup(wp); |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2701 #endif |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
2702 } |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2703 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2704 |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2705 /* |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2706 * popup_settext({id}, {text}) |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2707 */ |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2708 void |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2709 f_popup_settext(typval_T *argvars, typval_T *rettv UNUSED) |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2710 { |
25338
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2711 int id; |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2712 win_T *wp; |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2713 |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2714 if (in_vim9script() |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2715 && (check_for_number_arg(argvars, 0) == FAIL |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2716 || check_for_string_or_list_arg(argvars, 1) == FAIL)) |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2717 return; |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2718 |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2719 id = (int)tv_get_number(&argvars[0]); |
e2be9f3c5907
patch 8.2.3206: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25300
diff
changeset
|
2720 wp = find_popup_win(id); |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2721 if (wp != NULL) |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2722 { |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2723 if (argvars[1].v_type != VAR_STRING && argvars[1].v_type != VAR_LIST) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26690
diff
changeset
|
2724 semsg(_(e_invalid_argument_str), tv_get_string(&argvars[1])); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2725 else |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2726 { |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2727 popup_set_buffer_text(wp->w_buffer, argvars[1]); |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
2728 redraw_win_later(wp, UPD_NOT_VALID); |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2729 popup_adjust_position(wp); |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2730 } |
17107
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2731 } |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2732 } |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2733 |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
2734 static void |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2735 popup_free(win_T *wp) |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
2736 { |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
2737 sign_undefine_by_name(popup_get_sign_name(wp), FALSE); |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2738 wp->w_buffer->b_locked = FALSE; |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
2739 if (wp->w_winrow + popup_height(wp) >= cmdline_row) |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
2740 clear_cmdline = TRUE; |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
2741 win_free_popup(wp); |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
2742 |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
2743 redraw_all_later(UPD_NOT_VALID); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
2744 popup_mask_refresh = TRUE; |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
2745 } |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16796
diff
changeset
|
2746 |
19637
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2747 static void |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2748 error_for_popup_window(void) |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2749 { |
26986
79ea140936e9
patch 8.2.4022: two error messages in the wrong file
Bram Moolenaar <Bram@vim.org>
parents:
26962
diff
changeset
|
2750 emsg(_(e_not_allowed_in_popup_window)); |
19637
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2751 } |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2752 |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2753 int |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2754 error_if_popup_window(int also_with_term UNUSED) |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2755 { |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2756 // win_execute() may set "curwin" to a popup window temporarily, but many |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2757 // commands are disallowed then. When a terminal runs in the popup most |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2758 // things are allowed. When a terminal is finished it can be closed. |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2759 if (WIN_IS_POPUP(curwin) |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2760 # ifdef FEAT_TERMINAL |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2761 && (also_with_term || curbuf->b_term == NULL) |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2762 # endif |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2763 ) |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2764 { |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2765 error_for_popup_window(); |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2766 return TRUE; |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2767 } |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2768 return FALSE; |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2769 } |
8de319d1b82c
patch 8.2.0375: Coverity warning for not using return value
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
2770 |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2771 /* |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2772 * Close a popup window by Window-id. |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
2773 * Does not invoke the callback. |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2774 * Return OK if the popup was closed, FAIL otherwise. |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2775 */ |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2776 int |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2777 popup_close(int id, int force) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2778 { |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2779 win_T *wp; |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2780 tabpage_T *tp; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2781 win_T *prev = NULL; |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2782 |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2783 // go through global popups |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2784 for (wp = first_popupwin; wp != NULL; prev = wp, wp = wp->w_next) |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2785 if (wp->w_id == id) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2786 { |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2787 if (wp == curwin) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2788 { |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2789 if (!force) |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2790 { |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2791 error_for_popup_window(); |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2792 return FAIL; |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2793 } |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2794 back_to_prevwin(wp); |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2795 } |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2796 if (prev == NULL) |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2797 first_popupwin = wp->w_next; |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2798 else |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2799 prev->w_next = wp->w_next; |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2800 popup_free(wp); |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2801 return OK; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2802 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2803 |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2804 // go through tab-local popups |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2805 FOR_ALL_TABPAGES(tp) |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2806 if (popup_close_tabpage(tp, id, force) == OK) |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2807 return OK; |
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2808 return FAIL; |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2809 } |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2810 |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2811 /* |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2812 * Close a popup window with Window-id "id" in tabpage "tp". |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2813 */ |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2814 int |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2815 popup_close_tabpage(tabpage_T *tp, int id, int force) |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2816 { |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2817 win_T *wp; |
16796
5f98d80d116a
patch 8.1.1400: using global pointer for tab-local popups is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
2818 win_T **root = &tp->tp_first_popupwin; |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2819 win_T *prev = NULL; |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2820 |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2821 for (wp = *root; wp != NULL; prev = wp, wp = wp->w_next) |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2822 if (wp->w_id == id) |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2823 { |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2824 if (wp == curwin) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2825 { |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2826 if (!force) |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2827 { |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2828 error_for_popup_window(); |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2829 return FAIL; |
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2830 } |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20599
diff
changeset
|
2831 back_to_prevwin(wp); |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
2832 } |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2833 if (prev == NULL) |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2834 *root = wp->w_next; |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2835 else |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2836 prev->w_next = wp->w_next; |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
2837 popup_free(wp); |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2838 return OK; |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2839 } |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2840 return FAIL; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2841 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2842 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2843 void |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2844 close_all_popups(int force) |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2845 { |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2846 if (!force && ERROR_IF_ANY_POPUP_WINDOW) |
19166
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19117
diff
changeset
|
2847 return; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2848 while (first_popupwin != NULL) |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2849 if (popup_close(first_popupwin->w_id, force) == FAIL) |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2850 return; |
16796
5f98d80d116a
patch 8.1.1400: using global pointer for tab-local popups is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
2851 while (curtab->tp_first_popupwin != NULL) |
20384
42ab4d40e78f
patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents:
20382
diff
changeset
|
2852 if (popup_close(curtab->tp_first_popupwin->w_id, force) == FAIL) |
20382
361069b687d6
patch 8.2.0746: popup_clear() hangs when a popup can't be closed
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
2853 return; |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2854 } |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2855 |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2856 /* |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2857 * popup_move({id}, {options}) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2858 */ |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2859 void |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2860 f_popup_move(typval_T *argvars, typval_T *rettv UNUSED) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2861 { |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2862 dict_T *dict; |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2863 int id; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2864 win_T *wp; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2865 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2866 if (in_vim9script() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2867 && (check_for_number_arg(argvars, 0) == FAIL |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2868 || check_for_dict_arg(argvars, 1) == FAIL)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2869 return; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2870 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2871 id = (int)tv_get_number(argvars); |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2872 wp = find_popup_win(id); |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2873 if (wp == NULL) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2874 return; // invalid {id} |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2875 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2876 if (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2877 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
2878 emsg(_(e_dictionary_required)); |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2879 return; |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2880 } |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2881 dict = argvars[1].vval.v_dict; |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2882 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2883 apply_move_options(wp, dict); |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2884 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2885 if (wp->w_winrow + wp->w_height >= cmdline_row) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2886 clear_cmdline = TRUE; |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2887 popup_adjust_position(wp); |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2888 } |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
2889 |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2890 /* |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2891 * popup_setoptions({id}, {options}) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2892 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2893 void |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2894 f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2895 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2896 dict_T *dict; |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2897 int id; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2898 win_T *wp; |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
2899 linenr_T old_firstline; |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2900 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2901 if (in_vim9script() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2902 && (check_for_number_arg(argvars, 0) == FAIL |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2903 || check_for_dict_arg(argvars, 1) == FAIL)) |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2904 return; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2905 |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2906 id = (int)tv_get_number(argvars); |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
2907 wp = find_popup_win(id); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2908 if (wp == NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2909 return; // invalid {id} |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2910 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2911 if (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2912 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
2913 emsg(_(e_dictionary_required)); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2914 return; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2915 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2916 dict = argvars[1].vval.v_dict; |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
2917 old_firstline = wp->w_firstline; |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2918 |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
2919 apply_options(wp, dict, FALSE); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2920 |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
2921 if (old_firstline != wp->w_firstline) |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
2922 redraw_win_later(wp, UPD_NOT_VALID); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2923 popup_adjust_position(wp); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2924 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2925 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2926 /* |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
2927 * popup_getpos({id}) |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2928 */ |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2929 void |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
2930 f_popup_getpos(typval_T *argvars, typval_T *rettv) |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2931 { |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2932 dict_T *dict; |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2933 int id; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2934 win_T *wp; |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2935 int top_extra; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2936 int left_extra; |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2937 |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2938 if (rettv_dict_alloc(rettv) == OK) |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2939 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2940 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2941 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2942 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2943 id = (int)tv_get_number(argvars); |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
2944 wp = find_popup_win(id); |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2945 if (wp == NULL) |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2946 return; // invalid {id} |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
2947 top_extra = popup_top_extra(wp); |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2948 left_extra = wp->w_popup_border[3] + wp->w_popup_padding[3]; |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2949 |
17508
34966be2e856
patch 8.1.1752: resizing hashtable is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17506
diff
changeset
|
2950 // we know how much space we need, avoid resizing halfway |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2951 dict = rettv->vval.v_dict; |
17508
34966be2e856
patch 8.1.1752: resizing hashtable is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17506
diff
changeset
|
2952 hash_lock_size(&dict->dv_hashtab, 11); |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2953 |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2954 dict_add_number(dict, "line", wp->w_winrow + 1); |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2955 dict_add_number(dict, "col", wp->w_wincol + 1); |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2956 dict_add_number(dict, "width", wp->w_width + left_extra |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2957 + wp->w_popup_border[1] + wp->w_popup_padding[1]); |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2958 dict_add_number(dict, "height", wp->w_height + top_extra |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
2959 + wp->w_popup_border[2] + wp->w_popup_padding[2]); |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2960 |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2961 dict_add_number(dict, "core_line", wp->w_winrow + 1 + top_extra); |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2962 dict_add_number(dict, "core_col", wp->w_wincol + 1 + left_extra); |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2963 dict_add_number(dict, "core_width", wp->w_width); |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2964 dict_add_number(dict, "core_height", wp->w_height); |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2965 |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
2966 dict_add_number(dict, "scrollbar", wp->w_has_scrollbar); |
17196
983950357c40
patch 8.1.1597: cannot scroll a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17194
diff
changeset
|
2967 dict_add_number(dict, "firstline", wp->w_topline); |
18512
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18492
diff
changeset
|
2968 dict_add_number(dict, "lastline", wp->w_botline - 1); |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
2969 dict_add_number(dict, "visible", |
16902
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
2970 win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0); |
17508
34966be2e856
patch 8.1.1752: resizing hashtable is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17506
diff
changeset
|
2971 |
34966be2e856
patch 8.1.1752: resizing hashtable is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17506
diff
changeset
|
2972 hash_unlock(&dict->dv_hashtab); |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
2973 } |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
2974 } |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2975 |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2976 /* |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2977 * popup_list() |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2978 */ |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2979 void |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2980 f_popup_list(typval_T *argvars UNUSED, typval_T *rettv) |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2981 { |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2982 win_T *wp; |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2983 tabpage_T *tp; |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2984 |
29239
da56650de132
patch 8.2.5138: various small issues
Bram Moolenaar <Bram@vim.org>
parents:
29046
diff
changeset
|
2985 if (rettv_list_alloc(rettv) == FAIL) |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2986 return; |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2987 FOR_ALL_POPUPWINS(wp) |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2988 list_append_number(rettv->vval.v_list, wp->w_id); |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2989 FOR_ALL_TABPAGES(tp) |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2990 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2991 list_append_number(rettv->vval.v_list, wp->w_id); |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2992 } |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20384
diff
changeset
|
2993 |
17348
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
2994 /* |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
2995 * popup_locate({row}, {col}) |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
2996 */ |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
2997 void |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
2998 f_popup_locate(typval_T *argvars, typval_T *rettv) |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
2999 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3000 int row; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3001 int col; |
17348
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
3002 win_T *wp; |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
3003 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3004 if (in_vim9script() |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3005 && (check_for_number_arg(argvars, 0) == FAIL |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3006 || check_for_number_arg(argvars, 1) == FAIL)) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3007 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3008 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3009 row = tv_get_number(&argvars[0]) - 1; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3010 col = tv_get_number(&argvars[1]) - 1; |
17348
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
3011 wp = mouse_find_win(&row, &col, FIND_POPUP); |
18685
ff4174f1ed3a
patch 8.1.2334: possible NULL pointer dereference in popup_locate()
Bram Moolenaar <Bram@vim.org>
parents:
18629
diff
changeset
|
3012 if (wp != NULL && WIN_IS_POPUP(wp)) |
17348
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
3013 rettv->vval.v_number = wp->w_id; |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17334
diff
changeset
|
3014 } |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3015 |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3016 /* |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3017 * For popup_getoptions(): add a "border" or "padding" entry to "dict". |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3018 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3019 static void |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3020 get_padding_border(dict_T *dict, int *array, char *name) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3021 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3022 list_T *list; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3023 int i; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3024 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3025 if (array[0] == 0 && array[1] == 0 && array[2] == 0 && array[3] == 0) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3026 return; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3027 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3028 list = list_alloc(); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3029 if (list != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3030 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3031 dict_add_list(dict, name, list); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3032 if (array[0] != 1 || array[1] != 1 || array[2] != 1 || array[3] != 1) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3033 for (i = 0; i < 4; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3034 list_append_number(list, array[i]); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3035 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3036 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3037 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3038 /* |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3039 * For popup_getoptions(): add a "borderhighlight" entry to "dict". |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3040 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3041 static void |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3042 get_borderhighlight(dict_T *dict, win_T *wp) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3043 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3044 list_T *list; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3045 int i; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3046 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3047 for (i = 0; i < 4; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3048 if (wp->w_border_highlight[i] != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3049 break; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3050 if (i == 4) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3051 return; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3052 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3053 list = list_alloc(); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3054 if (list != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3055 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3056 dict_add_list(dict, "borderhighlight", list); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3057 for (i = 0; i < 4; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3058 list_append_string(list, wp->w_border_highlight[i], -1); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3059 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3060 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3061 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3062 /* |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3063 * For popup_getoptions(): add a "borderchars" entry to "dict". |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3064 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3065 static void |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3066 get_borderchars(dict_T *dict, win_T *wp) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3067 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3068 list_T *list; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3069 int i; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3070 char_u buf[NUMBUFLEN]; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3071 int len; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3072 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3073 for (i = 0; i < 8; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3074 if (wp->w_border_char[i] != 0) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3075 break; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3076 if (i == 8) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3077 return; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3078 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3079 list = list_alloc(); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3080 if (list != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3081 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3082 dict_add_list(dict, "borderchars", list); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3083 for (i = 0; i < 8; ++i) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3084 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3085 len = mb_char2bytes(wp->w_border_char[i], buf); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3086 list_append_string(list, buf, len); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3087 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3088 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3089 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3090 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3091 /* |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3092 * For popup_getoptions(): add a "moved" and "mousemoved" entry to "dict". |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3093 */ |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3094 static void |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3095 get_moved_list(dict_T *dict, win_T *wp) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3096 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3097 list_T *list; |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3098 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3099 list = list_alloc(); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3100 if (list != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3101 { |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3102 dict_add_list(dict, "moved", list); |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3103 list_append_number(list, wp->w_popup_lnum); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3104 list_append_number(list, wp->w_popup_mincol); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3105 list_append_number(list, wp->w_popup_maxcol); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3106 } |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3107 list = list_alloc(); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3108 if (list != NULL) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3109 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3110 dict_add_list(dict, "mousemoved", list); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3111 list_append_number(list, wp->w_popup_mouse_row); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3112 list_append_number(list, wp->w_popup_mouse_mincol); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3113 list_append_number(list, wp->w_popup_mouse_maxcol); |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17274
diff
changeset
|
3114 } |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3115 } |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3116 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3117 /* |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16908
diff
changeset
|
3118 * popup_getoptions({id}) |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3119 */ |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3120 void |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3121 f_popup_getoptions(typval_T *argvars, typval_T *rettv) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3122 { |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3123 dict_T *dict; |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3124 int id; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3125 win_T *wp; |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3126 tabpage_T *tp; |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3127 int i; |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3128 |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3129 if (rettv_dict_alloc(rettv) == OK) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3130 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3131 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3132 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3133 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3134 id = (int)tv_get_number(argvars); |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
3135 wp = find_popup_win(id); |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3136 if (wp == NULL) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3137 return; |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3138 |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3139 dict = rettv->vval.v_dict; |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3140 dict_add_number(dict, "line", wp->w_wantline); |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3141 dict_add_number(dict, "col", wp->w_wantcol); |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3142 dict_add_number(dict, "minwidth", wp->w_minwidth); |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3143 dict_add_number(dict, "minheight", wp->w_minheight); |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3144 dict_add_number(dict, "maxheight", wp->w_maxheight); |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3145 dict_add_number(dict, "maxwidth", wp->w_maxwidth); |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
3146 dict_add_number(dict, "firstline", wp->w_firstline); |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
3147 dict_add_number(dict, "scrollbar", wp->w_want_scrollbar); |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3148 dict_add_number(dict, "zindex", wp->w_zindex); |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
3149 dict_add_number(dict, "fixed", wp->w_popup_fixed); |
23857
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
3150 if (wp->w_popup_prop_type && win_valid_any_tab(wp->w_popup_prop_win)) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3151 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3152 proptype_T *pt = text_prop_type_by_id( |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3153 wp->w_popup_prop_win->w_buffer, |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3154 wp->w_popup_prop_type); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3155 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3156 if (pt != NULL) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3157 dict_add_string(dict, "textprop", pt->pt_name); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3158 dict_add_number(dict, "textpropwin", wp->w_popup_prop_win->w_id); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3159 dict_add_number(dict, "textpropid", wp->w_popup_prop_id); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3160 } |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3161 dict_add_string(dict, "title", wp->w_popup_title); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3162 dict_add_number(dict, "wrap", wp->w_p_wrap); |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
3163 dict_add_number(dict, "drag", (wp->w_popup_flags & POPF_DRAG) != 0); |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
3164 dict_add_number(dict, "dragall", |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
3165 (wp->w_popup_flags & POPF_DRAGALL) != 0); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3166 dict_add_number(dict, "mapping", |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3167 (wp->w_popup_flags & POPF_MAPPING) != 0); |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
3168 dict_add_number(dict, "resize", (wp->w_popup_flags & POPF_RESIZE) != 0); |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
3169 dict_add_number(dict, "posinvert", |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
3170 (wp->w_popup_flags & POPF_POSINVERT) != 0); |
17440
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
3171 dict_add_number(dict, "cursorline", |
a5874fdc8f3a
patch 8.1.1718: popup menu highlighting does not look good
Bram Moolenaar <Bram@vim.org>
parents:
17431
diff
changeset
|
3172 (wp->w_popup_flags & POPF_CURSORLINE) != 0); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3173 dict_add_string(dict, "highlight", wp->w_p_wcr); |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3174 if (wp->w_scrollbar_highlight != NULL) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3175 dict_add_string(dict, "scrollbarhighlight", |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3176 wp->w_scrollbar_highlight); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3177 if (wp->w_thumb_highlight != NULL) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3178 dict_add_string(dict, "thumbhighlight", wp->w_thumb_highlight); |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3179 |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3180 // find the tabpage that holds this popup |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3181 i = 1; |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3182 FOR_ALL_TABPAGES(tp) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3183 { |
18229
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18225
diff
changeset
|
3184 win_T *twp; |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18225
diff
changeset
|
3185 |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3186 FOR_ALL_POPUPWINS_IN_TAB(tp, twp) |
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3187 if (twp->w_id == id) |
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3188 break; |
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3189 if (twp != NULL) |
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3190 break; |
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3191 ++i; |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3192 } |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3193 if (tp == NULL) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3194 i = -1; // must be global |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3195 else if (tp == curtab) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3196 i = 0; |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3197 dict_add_number(dict, "tabpage", i); |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
3198 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3199 get_padding_border(dict, wp->w_popup_padding, "padding"); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3200 get_padding_border(dict, wp->w_popup_border, "border"); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3201 get_borderhighlight(dict, wp); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3202 get_borderchars(dict, wp); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3203 get_moved_list(dict, wp); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3204 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3205 if (wp->w_filter_cb.cb_name != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3206 dict_add_callback(dict, "filter", &wp->w_filter_cb); |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3207 if (wp->w_close_cb.cb_name != NULL) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
3208 dict_add_callback(dict, "callback", &wp->w_close_cb); |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3209 |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
3210 for (i = 0; i < (int)ARRAY_LENGTH(poppos_entries); ++i) |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3211 if (wp->w_popup_pos == poppos_entries[i].pp_val) |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3212 { |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3213 dict_add_string(dict, "pos", |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3214 (char_u *)poppos_entries[i].pp_name); |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3215 break; |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3216 } |
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
3217 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
3218 dict_add_string(dict, "close", (char_u *)( |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
3219 wp->w_popup_close == POPCLOSE_BUTTON ? "button" |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
3220 : wp->w_popup_close == POPCLOSE_CLICK ? "click" : "none")); |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
3221 |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3222 # if defined(FEAT_TIMERS) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3223 dict_add_number(dict, "time", wp->w_popup_timer != NULL |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3224 ? (long)wp->w_popup_timer->tr_interval : 0L); |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
3225 # endif |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
3226 } |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
3227 } |
16874
da5f5836e90c
patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
16872
diff
changeset
|
3228 |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
3229 # if defined(FEAT_TERMINAL) || defined(PROTO) |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
3230 /* |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
3231 * Return TRUE if the current window is running a terminal in a popup window. |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
3232 * Return FALSE when the job has ended. |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
3233 */ |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3234 int |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3235 error_if_term_popup_window() |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3236 { |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
3237 if (WIN_IS_POPUP(curwin) && curbuf->b_term != NULL |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
3238 && term_job_running(curbuf->b_term)) |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3239 { |
26962
85866e069c24
patch 8.2.4010: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26915
diff
changeset
|
3240 emsg(_(e_not_allowed_for_terminal_in_popup_window)); |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3241 return TRUE; |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3242 } |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3243 return FALSE; |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3244 } |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
3245 # endif |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3246 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3247 /* |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3248 * Reset all the "handled_flag" flags in global popup windows and popup windows |
17075
dacd46fbaa90
patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents:
17057
diff
changeset
|
3249 * in the current tab page. |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3250 * Each calling function should use a different flag, see the list at |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3251 * POPUP_HANDLED_1. This won't work with recursive calls though. |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3252 */ |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3253 void |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3254 popup_reset_handled(int handled_flag) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3255 { |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3256 win_T *wp; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3257 |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3258 FOR_ALL_POPUPWINS(wp) |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3259 wp->w_popup_handled &= ~handled_flag; |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3260 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3261 wp->w_popup_handled &= ~handled_flag; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3262 } |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3263 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3264 /* |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3265 * Find the next visible popup where "handled_flag" is not set. |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3266 * Must have called popup_reset_handled() first. |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3267 * When "lowest" is TRUE find the popup with the lowest zindex, otherwise the |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3268 * popup with the highest zindex. |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3269 */ |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3270 win_T * |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3271 find_next_popup(int lowest, int handled_flag) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3272 { |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3273 win_T *wp; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3274 win_T *found_wp; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3275 int found_zindex; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3276 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3277 found_zindex = lowest ? INT_MAX : 0; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3278 found_wp = NULL; |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3279 FOR_ALL_POPUPWINS(wp) |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3280 if ((wp->w_popup_handled & handled_flag) == 0 |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3281 && (wp->w_popup_flags & POPF_HIDDEN) == 0 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3282 && (lowest ? wp->w_zindex < found_zindex |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3283 : wp->w_zindex > found_zindex)) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3284 { |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3285 found_zindex = wp->w_zindex; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3286 found_wp = wp; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3287 } |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3288 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3289 if ((wp->w_popup_handled & handled_flag) == 0 |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3290 && (wp->w_popup_flags & POPF_HIDDEN) == 0 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3291 && (lowest ? wp->w_zindex < found_zindex |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3292 : wp->w_zindex > found_zindex)) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3293 { |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3294 found_zindex = wp->w_zindex; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3295 found_wp = wp; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3296 } |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3297 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3298 if (found_wp != NULL) |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3299 found_wp->w_popup_handled |= handled_flag; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3300 return found_wp; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3301 } |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3302 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3303 /* |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3304 * Invoke the filter callback for window "wp" with typed character "c". |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3305 * Uses the global "mod_mask" for modifiers. |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3306 * Returns the return value of the filter or -1 for CTRL-C in the current |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3307 * window. |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3308 * Careful: The filter may make "wp" invalid! |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3309 */ |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3310 static int |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3311 invoke_popup_filter(win_T *wp, int c) |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3312 { |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3313 int res; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3314 typval_T rettv; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3315 typval_T argv[3]; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3316 char_u buf[NUMBUFLEN]; |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3317 linenr_T old_lnum = wp->w_cursor.lnum; |
22675
ff29f22c93f7
patch 8.2.1886: using ":silent!" in a popup filter has unexpected effect
Bram Moolenaar <Bram@vim.org>
parents:
22620
diff
changeset
|
3318 int prev_did_emsg = did_emsg; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3319 |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
3320 // Emergency exit: CTRL-C closes the popup. |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
3321 if (c == Ctrl_C) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
3322 { |
18239
9e696b8fee7d
patch 8.1.2114: when a popup is closed with CTRL-C the callback aborts
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3323 int save_got_int = got_int; |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3324 int was_curwin = wp == curwin; |
18239
9e696b8fee7d
patch 8.1.2114: when a popup is closed with CTRL-C the callback aborts
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3325 |
9e696b8fee7d
patch 8.1.2114: when a popup is closed with CTRL-C the callback aborts
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3326 // Reset got_int to avoid the callback isn't called. |
9e696b8fee7d
patch 8.1.2114: when a popup is closed with CTRL-C the callback aborts
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3327 got_int = FALSE; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3328 popup_close_with_retval(wp, -1); |
18239
9e696b8fee7d
patch 8.1.2114: when a popup is closed with CTRL-C the callback aborts
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3329 got_int |= save_got_int; |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3330 |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3331 // If the popup is the current window it probably fails to close. Then |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3332 // do not consume the key. |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3333 if (was_curwin && wp == curwin) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3334 return -1; |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3335 return TRUE; |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
3336 } |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
3337 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3338 argv[0].v_type = VAR_NUMBER; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3339 argv[0].vval.v_number = (varnumber_T)wp->w_id; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3340 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3341 // Convert the number to a string, so that the function can use: |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3342 // if a:c == "\<F2>" |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
3343 buf[special_to_buf(c, mod_mask, FALSE, buf)] = NUL; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3344 argv[1].v_type = VAR_STRING; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3345 argv[1].vval.v_string = vim_strsave(buf); |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3346 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3347 argv[2].v_type = VAR_UNKNOWN; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3348 |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
3349 // NOTE: The callback might close the popup and make "wp" invalid. |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3350 if (call_callback(&wp->w_filter_cb, -1, &rettv, 2, argv) == FAIL) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3351 { |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3352 // Cannot call the function, close the popup to avoid that the filter |
22178
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3353 // eats keys and the user is stuck. Might as well eat the key. |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3354 popup_close_with_retval(wp, -1); |
22178
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3355 res = TRUE; |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3356 } |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3357 else |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3358 { |
22178
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3359 if (win_valid_popup(wp) && old_lnum != wp->w_cursor.lnum) |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3360 popup_highlight_curline(wp); |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3361 |
22675
ff29f22c93f7
patch 8.2.1886: using ":silent!" in a popup filter has unexpected effect
Bram Moolenaar <Bram@vim.org>
parents:
22620
diff
changeset
|
3362 // If an error message was given always return FALSE, so that keys are |
ff29f22c93f7
patch 8.2.1886: using ":silent!" in a popup filter has unexpected effect
Bram Moolenaar <Bram@vim.org>
parents:
22620
diff
changeset
|
3363 // not consumed and the user can type something. |
22178
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3364 // If we get three errors in a row then close the popup. Decrement the |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3365 // error count by 1/10 if there are no errors, thus allowing up to 1 in |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3366 // 10 calls to cause an error. |
22675
ff29f22c93f7
patch 8.2.1886: using ":silent!" in a popup filter has unexpected effect
Bram Moolenaar <Bram@vim.org>
parents:
22620
diff
changeset
|
3367 if (win_valid_popup(wp) && did_emsg > prev_did_emsg) |
22178
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3368 { |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3369 wp->w_filter_errors += 10; |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3370 if (wp->w_filter_errors >= 30) |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3371 popup_close_with_retval(wp, -1); |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3372 res = FALSE; |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3373 } |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3374 else |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3375 { |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3376 if (win_valid_popup(wp) && wp->w_filter_errors > 0) |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3377 --wp->w_filter_errors; |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3378 res = tv_get_bool(&rettv); |
6666ace75ef5
patch 8.2.1638: leaking memory when popup filter function can't be called
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
3379 } |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
3380 } |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
3381 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3382 vim_free(argv[1].vval.v_string); |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3383 clear_tv(&rettv); |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3384 return res; |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3385 } |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3386 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3387 /* |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3388 * Called when "c" was typed: invoke popup filter callbacks. |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3389 * Returns TRUE when the character was consumed, |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3390 */ |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3391 int |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3392 popup_do_filter(int c) |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3393 { |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3394 static int recursive = FALSE; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3395 int res = FALSE; |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
3396 win_T *wp; |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3397 int save_KeyTyped = KeyTyped; |
17946
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
3398 int state; |
18004
6006bb74bd52
patch 8.1.1998: redraw even when no popup window filter was invoked
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3399 int was_must_redraw = must_redraw; |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3400 |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
3401 #ifdef FEAT_TERMINAL |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3402 // Popup window with terminal always gets focus. |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3403 if (popup_is_popup(curwin) && curbuf->b_term != NULL) |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3404 return FALSE; |
19267
c7903f92ed75
patch 8.2.0192: build failure without +terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
3405 #endif |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
3406 |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3407 if (recursive) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3408 return FALSE; |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3409 recursive = TRUE; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3410 |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3411 if (c == K_LEFTMOUSE) |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3412 { |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3413 int row = mouse_row; |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3414 int col = mouse_col; |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3415 |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3416 wp = mouse_find_win(&row, &col, FIND_POPUP); |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3417 if (wp != NULL && popup_close_if_on_X(wp, row, col)) |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3418 res = TRUE; |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3419 } |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
3420 |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3421 popup_reset_handled(POPUP_HANDLED_2); |
17946
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
3422 state = get_real_state(); |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3423 while (res == FALSE |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3424 && (wp = find_next_popup(FALSE, POPUP_HANDLED_2)) != NULL) |
17946
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
3425 if (wp->w_filter_cb.cb_name != NULL |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
3426 && (wp->w_filter_mode & state) != 0) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3427 res = invoke_popup_filter(wp, c); |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3428 |
18004
6006bb74bd52
patch 8.1.1998: redraw even when no popup window filter was invoked
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3429 if (must_redraw > was_must_redraw) |
21731
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3430 { |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3431 int save_got_int = got_int; |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3432 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3433 // Reset got_int to avoid a function used in the statusline aborts. |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3434 got_int = FALSE; |
26466
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26439
diff
changeset
|
3435 redraw_after_callback(FALSE, FALSE); |
21731
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3436 got_int |= save_got_int; |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3437 } |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3438 recursive = FALSE; |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
3439 KeyTyped = save_KeyTyped; |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3440 |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3441 // When interrupted return FALSE to avoid looping. |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
3442 return res == -1 ? FALSE : res; |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3443 } |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16874
diff
changeset
|
3444 |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3445 /* |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3446 * Return TRUE if there is a popup visible with a filter callback and the |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3447 * "mapping" property off. |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3448 */ |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3449 int |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3450 popup_no_mapping(void) |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3451 { |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3452 int round; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3453 win_T *wp; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3454 |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3455 for (round = 1; round <= 2; ++round) |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3456 for (wp = round == 1 ? first_popupwin : curtab->tp_first_popupwin; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3457 wp != NULL; wp = wp->w_next) |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3458 if (wp->w_filter_cb.cb_name != NULL |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3459 && (wp->w_popup_flags & (POPF_HIDDEN | POPF_MAPPING)) == 0) |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3460 return TRUE; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3461 return FALSE; |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3462 } |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3463 |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17584
diff
changeset
|
3464 /* |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3465 * Called when the cursor moved: check if any popup needs to be closed if the |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3466 * cursor moved far enough. |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3467 */ |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3468 void |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3469 popup_check_cursor_pos() |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3470 { |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3471 win_T *wp; |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3472 |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3473 popup_reset_handled(POPUP_HANDLED_3); |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3474 while ((wp = find_next_popup(TRUE, POPUP_HANDLED_3)) != NULL) |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3475 if (wp->w_popup_curwin != NULL |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3476 && (curwin != wp->w_popup_curwin |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3477 || curwin->w_cursor.lnum != wp->w_popup_lnum |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3478 || curwin->w_cursor.col < wp->w_popup_mincol |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3479 || curwin->w_cursor.col > wp->w_popup_maxcol)) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3480 popup_close_with_retval(wp, -1); |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3481 } |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
3482 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3483 /* |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3484 * Update "w_popup_mask_cells". |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3485 */ |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3486 static void |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3487 popup_update_mask(win_T *wp, int width, int height) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3488 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3489 listitem_T *lio, *li; |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3490 char_u *cells; |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3491 int row, col; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3492 |
23936
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
3493 if (wp->w_popup_mask == NULL || width == 0 || height == 0) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
3494 { |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
3495 vim_free(wp->w_popup_mask_cells); |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
3496 wp->w_popup_mask_cells = NULL; |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3497 return; |
23936
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
3498 } |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3499 if (wp->w_popup_mask_cells != NULL |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3500 && wp->w_popup_mask_height == height |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3501 && wp->w_popup_mask_width == width) |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3502 return; // cache is still valid |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3503 |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3504 vim_free(wp->w_popup_mask_cells); |
27453
c7f614c9ceb3
patch 8.2.4255: theoretical computation overflow
Bram Moolenaar <Bram@vim.org>
parents:
26986
diff
changeset
|
3505 wp->w_popup_mask_cells = alloc_clear((size_t)width * height); |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3506 if (wp->w_popup_mask_cells == NULL) |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3507 return; |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3508 cells = wp->w_popup_mask_cells; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3509 |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3510 FOR_ALL_LIST_ITEMS(wp->w_popup_mask, lio) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3511 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3512 int cols, cole; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3513 int lines, linee; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3514 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3515 li = lio->li_tv.vval.v_list->lv_first; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3516 cols = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3517 if (cols < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3518 cols = width + cols + 1; |
23400
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3519 if (cols <= 0) |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3520 cols = 1; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3521 li = li->li_next; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3522 cole = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3523 if (cole < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3524 cole = width + cole + 1; |
23400
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3525 if (cole > width) |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3526 cole = width; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3527 li = li->li_next; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3528 lines = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3529 if (lines < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3530 lines = height + lines + 1; |
23400
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3531 if (lines <= 0) |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3532 lines = 1; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3533 li = li->li_next; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3534 linee = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3535 if (linee < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3536 linee = height + linee + 1; |
23400
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3537 if (linee > height) |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3538 linee = height; |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3539 |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3540 for (row = lines - 1; row < linee; ++row) |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3541 for (col = cols - 1; col < cole; ++col) |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3542 cells[row * width + col] = 1; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3543 } |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3544 } |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3545 |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3546 /* |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3547 * Return TRUE if "col" / "line" matches with an entry in w_popup_mask. |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3548 * "col" and "line" are screen coordinates. |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3549 */ |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3550 static int |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3551 popup_masked(win_T *wp, int width, int height, int screencol, int screenline) |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3552 { |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3553 int col = screencol - wp->w_wincol + wp->w_popup_leftoff; |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3554 int line = screenline - wp->w_winrow; |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3555 |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3556 return col >= 0 && col < width |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3557 && line >= 0 && line < height |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3558 && wp->w_popup_mask_cells[line * width + col]; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3559 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3560 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3561 /* |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3562 * Set flags in popup_transparent[] for window "wp" to "val". |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3563 */ |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3564 static void |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3565 update_popup_transparent(win_T *wp, int val) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3566 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3567 if (wp->w_popup_mask != NULL) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3568 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3569 int width = popup_width(wp); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3570 int height = popup_height(wp); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3571 listitem_T *lio, *li; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3572 int cols, cole; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3573 int lines, linee; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3574 int col, line; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3575 |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3576 FOR_ALL_LIST_ITEMS(wp->w_popup_mask, lio) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3577 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3578 li = lio->li_tv.vval.v_list->lv_first; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3579 cols = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3580 if (cols < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3581 cols = width + cols + 1; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3582 li = li->li_next; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3583 cole = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3584 if (cole < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3585 cole = width + cole + 1; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3586 li = li->li_next; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3587 lines = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3588 if (lines < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3589 lines = height + lines + 1; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3590 li = li->li_next; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3591 linee = tv_get_number(&li->li_tv); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3592 if (linee < 0) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3593 linee = height + linee + 1; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3594 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3595 --cols; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3596 cols -= wp->w_popup_leftoff; |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
3597 if (cols < 0) |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
3598 cols = 0; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3599 cole -= wp->w_popup_leftoff; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3600 --lines; |
17206
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
3601 if (lines < 0) |
8ca93f88b84a
patch 8.1.1602: popup window cannot overflow on the left or right
Bram Moolenaar <Bram@vim.org>
parents:
17202
diff
changeset
|
3602 lines = 0; |
17332
61f0bf94ef92
patch 8.1.1665: crash when popup window with mask is below the screen
Bram Moolenaar <Bram@vim.org>
parents:
17328
diff
changeset
|
3603 for (line = lines; line < linee |
61f0bf94ef92
patch 8.1.1665: crash when popup window with mask is below the screen
Bram Moolenaar <Bram@vim.org>
parents:
17328
diff
changeset
|
3604 && line + wp->w_winrow < screen_Rows; ++line) |
61f0bf94ef92
patch 8.1.1665: crash when popup window with mask is below the screen
Bram Moolenaar <Bram@vim.org>
parents:
17328
diff
changeset
|
3605 for (col = cols; col < cole |
61f0bf94ef92
patch 8.1.1665: crash when popup window with mask is below the screen
Bram Moolenaar <Bram@vim.org>
parents:
17328
diff
changeset
|
3606 && col + wp->w_wincol < screen_Columns; ++col) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3607 popup_transparent[(line + wp->w_winrow) * screen_Columns |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3608 + col + wp->w_wincol] = val; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3609 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3610 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3611 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3612 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3613 /* |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3614 * Only called when popup window "wp" is hidden: If the window is positioned |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3615 * next to a text property, and it is now visible, then unhide the popup. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3616 * We don't check if visible popups become hidden, that is done in |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3617 * popup_adjust_position(). |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3618 * Return TRUE if the popup became unhidden. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3619 */ |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3620 static int |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3621 check_popup_unhidden(win_T *wp) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3622 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3623 if (wp->w_popup_prop_type > 0 && win_valid(wp->w_popup_prop_win)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3624 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3625 textprop_T prop; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3626 linenr_T lnum; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3627 |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
3628 if ((wp->w_popup_flags & POPF_HIDDEN_FORCE) == 0 |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
3629 && find_visible_prop(wp->w_popup_prop_win, |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
3630 wp->w_popup_prop_type, wp->w_popup_prop_id, |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3631 &prop, &lnum) == OK) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3632 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3633 wp->w_popup_flags &= ~POPF_HIDDEN; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3634 wp->w_popup_prop_topline = 0; // force repositioning |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3635 return TRUE; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3636 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3637 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3638 return FALSE; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3639 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3640 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3641 /* |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3642 * Return TRUE if popup_adjust_position() needs to be called for "wp". |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3643 * That is when the buffer in the popup was changed, or the popup is following |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3644 * a textprop and the referenced buffer was changed. |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18004
diff
changeset
|
3645 * Or when the cursor line changed and "cursorline" is set. |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3646 */ |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3647 static int |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3648 popup_need_position_adjust(win_T *wp) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3649 { |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3650 if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3651 return TRUE; |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3652 if (win_valid(wp->w_popup_prop_win) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3653 && (wp->w_popup_prop_changedtick |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3654 != CHANGEDTICK(wp->w_popup_prop_win->w_buffer) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3655 || wp->w_popup_prop_topline != wp->w_popup_prop_win->w_topline)) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3656 return TRUE; |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3657 |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3658 // May need to adjust the width if the cursor moved. |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3659 return wp->w_cursor.lnum != wp->w_popup_last_curline; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3660 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3661 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3662 /* |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3663 * Update "popup_mask" if needed. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3664 * Also recomputes the popup size and positions. |
28187
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
3665 * Also updates "popup_visible" and "popup_uses_mouse_move". |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3666 * Also marks window lines for redrawing. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3667 */ |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3668 void |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3669 may_update_popup_mask(int type) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3670 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3671 win_T *wp; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3672 short *mask; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3673 int line, col; |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3674 int redraw_all_popups = FALSE; |
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3675 int redrawing_all_win; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3676 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3677 // Need to recompute when switching tabs. |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
3678 // Also recompute when the type is UPD_CLEAR or UPD_NOT_VALID, something |
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
3679 // basic (such as the screen size) must have changed. |
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
3680 if (popup_mask_tab != curtab || type >= UPD_NOT_VALID) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3681 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3682 popup_mask_refresh = TRUE; |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3683 redraw_all_popups = TRUE; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3684 } |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3685 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3686 // Check if any popup window buffer has changed and if any popup connected |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3687 // to a text property has become visible. |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3688 FOR_ALL_POPUPWINS(wp) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3689 if (wp->w_popup_flags & POPF_HIDDEN) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3690 popup_mask_refresh |= check_popup_unhidden(wp); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3691 else if (popup_need_position_adjust(wp)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3692 popup_mask_refresh = TRUE; |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
3693 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3694 if (wp->w_popup_flags & POPF_HIDDEN) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3695 popup_mask_refresh |= check_popup_unhidden(wp); |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3696 else if (popup_need_position_adjust(wp)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3697 popup_mask_refresh = TRUE; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3698 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3699 if (!popup_mask_refresh) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3700 return; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3701 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3702 // Need to update the mask, something has changed. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3703 popup_mask_refresh = FALSE; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3704 popup_mask_tab = curtab; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3705 popup_visible = FALSE; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3706 |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3707 // If redrawing all windows, just update "popup_mask". |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3708 // If redrawing only what is needed, update "popup_mask_next" and then |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3709 // compare with "popup_mask" to see what changed. |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3710 redrawing_all_win = TRUE; |
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3711 FOR_ALL_WINDOWS(wp) |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
3712 if (wp->w_redr_type < UPD_SOME_VALID) |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3713 redrawing_all_win = FALSE; |
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3714 if (redrawing_all_win) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3715 mask = popup_mask; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3716 else |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3717 mask = popup_mask_next; |
27453
c7f614c9ceb3
patch 8.2.4255: theoretical computation overflow
Bram Moolenaar <Bram@vim.org>
parents:
26986
diff
changeset
|
3718 vim_memset(mask, 0, (size_t)screen_Rows * screen_Columns * sizeof(short)); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3719 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3720 // Find the window with the lowest zindex that hasn't been handled yet, |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3721 // so that the window with a higher zindex overwrites the value in |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3722 // popup_mask. |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3723 popup_reset_handled(POPUP_HANDLED_4); |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3724 while ((wp = find_next_popup(TRUE, POPUP_HANDLED_4)) != NULL) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3725 { |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3726 int width; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3727 int height; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3728 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3729 popup_visible = TRUE; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3730 |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3731 // Recompute the position if the text changed. It may make the popup |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3732 // hidden if it's attach to a text property that is no longer visible. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3733 if (redraw_all_popups || popup_need_position_adjust(wp)) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3734 { |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3735 popup_adjust_position(wp); |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3736 if (wp->w_popup_flags & POPF_HIDDEN) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3737 continue; |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
3738 } |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3739 |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3740 width = popup_width(wp); |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3741 height = popup_height(wp); |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3742 popup_update_mask(wp, width, height); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3743 for (line = wp->w_winrow; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3744 line < wp->w_winrow + height && line < screen_Rows; ++line) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3745 for (col = wp->w_wincol; |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3746 col < wp->w_wincol + width - wp->w_popup_leftoff |
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3747 && col < screen_Columns; ++col) |
26165
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
26127
diff
changeset
|
3748 if (wp->w_zindex < POPUPMENU_ZINDEX |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
26127
diff
changeset
|
3749 && pum_visible() |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
26127
diff
changeset
|
3750 && pum_under_menu(line, col, FALSE)) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
26127
diff
changeset
|
3751 mask[line * screen_Columns + col] = POPUPMENU_ZINDEX; |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
26127
diff
changeset
|
3752 else if (wp->w_popup_mask_cells == NULL |
17510
a5427e35d0fb
patch 8.1.1753: use of popup window mask is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17508
diff
changeset
|
3753 || !popup_masked(wp, width, height, col, line)) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3754 mask[line * screen_Columns + col] = wp->w_zindex; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3755 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3756 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3757 // Only check which lines are to be updated if not already |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3758 // updating all lines. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3759 if (mask == popup_mask_next) |
17506
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3760 { |
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3761 int *plines_cache = ALLOC_CLEAR_MULT(int, Rows); |
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3762 win_T *prev_wp = NULL; |
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3763 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3764 for (line = 0; line < screen_Rows; ++line) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3765 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3766 int col_done = 0; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3767 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3768 for (col = 0; col < screen_Columns; ++col) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3769 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3770 int off = line * screen_Columns + col; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3771 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3772 if (popup_mask[off] != popup_mask_next[off]) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3773 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3774 popup_mask[off] = popup_mask_next[off]; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3775 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3776 if (line >= cmdline_row) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3777 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3778 // the command line needs to be cleared if text below |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3779 // the popup is now visible. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3780 if (!msg_scrolled && popup_mask_next[off] == 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3781 clear_cmdline = TRUE; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3782 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3783 else if (col >= col_done) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3784 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3785 linenr_T lnum; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3786 int line_cp = line; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3787 int col_cp = col; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3788 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3789 // The screen position "line" / "col" needs to be |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3790 // redrawn. Figure out what window that is and update |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3791 // w_redraw_top and w_redr_bot. Only needs to be done |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3792 // once for each window line. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3793 wp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP); |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3794 if (wp != NULL) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3795 { |
21291
c6fc976a8741
patch 8.2.1196: build failure with normal features
Bram Moolenaar <Bram@vim.org>
parents:
21285
diff
changeset
|
3796 #if defined(FEAT_TERMINAL) |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3797 // A terminal window needs to be redrawn. |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3798 if (bt_terminal(wp->w_buffer)) |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
3799 redraw_win_later(wp, UPD_NOT_VALID); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3800 else |
21291
c6fc976a8741
patch 8.2.1196: build failure with normal features
Bram Moolenaar <Bram@vim.org>
parents:
21285
diff
changeset
|
3801 #endif |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3802 { |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3803 if (wp != prev_wp) |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3804 { |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3805 vim_memset(plines_cache, 0, |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3806 sizeof(int) * Rows); |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3807 prev_wp = wp; |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3808 } |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3809 |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3810 if (line_cp >= wp->w_height) |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3811 // In (or below) status line |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3812 wp->w_redr_status = TRUE; |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3813 else |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3814 { |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3815 // compute the position in the buffer line |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3816 // from the position in the window |
28089
d3adf7b141a9
patch 8.2.4569: Coverity warning for not using a return value
Bram Moolenaar <Bram@vim.org>
parents:
27453
diff
changeset
|
3817 (void)mouse_comp_pos(wp, &line_cp, &col_cp, |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3818 &lnum, plines_cache); |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3819 redrawWinline(wp, lnum); |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
3820 } |
17843
9696c76f2213
patch 8.1.1918: redrawing popups is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
3821 } |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3822 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3823 // This line is going to be redrawn, no need to |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3824 // check until the right side of the window. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3825 col_done = wp->w_wincol + wp->w_width - 1; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3826 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3827 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3828 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3829 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3830 } |
17506
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3831 |
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3832 vim_free(plines_cache); |
74b6674b99fd
patch 8.1.1751: when redrawing popups plines_win() may be called often
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3833 } |
28187
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
3834 |
d27a9eed9849
patch 8.2.4619: mapping is cancelled when mouse moves and popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
28089
diff
changeset
|
3835 update_popup_uses_mouse_move(); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3836 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3837 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3838 /* |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3839 * If the current window is a popup and something relevant changed, recompute |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3840 * the position and size. |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3841 */ |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3842 void |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3843 may_update_popup_position(void) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3844 { |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3845 if (popup_is_popup(curwin) && popup_need_position_adjust(curwin)) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3846 popup_adjust_position(curwin); |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3847 } |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3848 |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
3849 /* |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3850 * Return a string of "len" spaces in IObuff. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3851 */ |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3852 static char_u * |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3853 get_spaces(int len) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3854 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3855 vim_memset(IObuff, ' ', (size_t)len); |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3856 IObuff[len] = NUL; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3857 return IObuff; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3858 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3859 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3860 /* |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3861 * Update popup windows. They are drawn on top of normal windows. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3862 * "win_update" is called for each popup window, lowest zindex first. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3863 */ |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3864 void |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3865 update_popups(void (*win_update)(win_T *wp)) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3866 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3867 win_T *wp; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3868 int top_off; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3869 int left_extra; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3870 int total_width; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3871 int total_height; |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
3872 int top_padding; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3873 int popup_attr; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3874 int border_attr[4]; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3875 int border_char[8]; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3876 char_u buf[MB_MAXBYTES]; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3877 int row; |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
3878 int wincol; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3879 int padcol = 0; |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3880 int padendcol = 0; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3881 int i; |
17200
db81cee3a0e1
patch 8.1.1599: compiler warning for uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
3882 int sb_thumb_top = 0; |
db81cee3a0e1
patch 8.1.1599: compiler warning for uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
3883 int sb_thumb_height = 0; |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3884 int attr_scroll = 0; |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
3885 int attr_thumb = 0; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3886 |
23035
fabd80ec9620
patch 8.2.2064: terminal: cursor is on while redrawing, causing flicker
Bram Moolenaar <Bram@vim.org>
parents:
22954
diff
changeset
|
3887 // hide the cursor until redrawing is done. |
fabd80ec9620
patch 8.2.2064: terminal: cursor is on while redrawing, causing flicker
Bram Moolenaar <Bram@vim.org>
parents:
22954
diff
changeset
|
3888 cursor_off(); |
fabd80ec9620
patch 8.2.2064: terminal: cursor is on while redrawing, causing flicker
Bram Moolenaar <Bram@vim.org>
parents:
22954
diff
changeset
|
3889 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3890 // Find the window with the lowest zindex that hasn't been updated yet, |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3891 // so that the window with a higher zindex is drawn later, thus goes on |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3892 // top. |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3893 popup_reset_handled(POPUP_HANDLED_5); |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3894 while ((wp = find_next_popup(TRUE, POPUP_HANDLED_5)) != NULL) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3895 { |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3896 int title_len = 0; |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3897 int title_wincol; |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3898 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3899 // This drawing uses the zindex of the popup window, so that it's on |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3900 // top of the text but doesn't draw when another popup with higher |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3901 // zindex is on top of the character. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3902 screen_zindex = wp->w_zindex; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3903 |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3904 // Set flags in popup_transparent[] for masked cells. |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3905 update_popup_transparent(wp, 1); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
3906 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3907 // adjust w_winrow and w_wincol for border and padding, since |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3908 // win_update() doesn't handle them. |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
3909 top_off = popup_top_extra(wp); |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3910 left_extra = wp->w_popup_padding[3] + wp->w_popup_border[3] |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3911 - wp->w_popup_leftoff; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3912 if (wp->w_wincol + left_extra < 0) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3913 left_extra = -wp->w_wincol; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3914 wp->w_winrow += top_off; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3915 wp->w_wincol += left_extra; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3916 |
17194
f4c6c1bc5e41
patch 8.1.1596: when resizing the screen may draw popup in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
17180
diff
changeset
|
3917 // Draw the popup text, unless it's off screen. |
f4c6c1bc5e41
patch 8.1.1596: when resizing the screen may draw popup in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
17180
diff
changeset
|
3918 if (wp->w_winrow < screen_Rows && wp->w_wincol < screen_Columns) |
17897
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3919 { |
22377
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
3920 // May need to update the "cursorline" highlighting, which may also |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
3921 // change "topline" |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
3922 if (wp->w_popup_last_curline != wp->w_cursor.lnum) |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
3923 popup_highlight_curline(wp); |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
3924 |
17194
f4c6c1bc5e41
patch 8.1.1596: when resizing the screen may draw popup in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
17180
diff
changeset
|
3925 win_update(wp); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3926 |
17897
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3927 // move the cursor into the visible lines, otherwise executing |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3928 // commands with win_execute() may cause the text to jump. |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3929 if (wp->w_cursor.lnum < wp->w_topline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3930 wp->w_cursor.lnum = wp->w_topline; |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3931 else if (wp->w_cursor.lnum >= wp->w_botline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3932 wp->w_cursor.lnum = wp->w_botline - 1; |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3933 } |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17879
diff
changeset
|
3934 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3935 wp->w_winrow -= top_off; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3936 wp->w_wincol -= left_extra; |
22886
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3937 |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3938 // Add offset for border and padding if not done already. |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3939 if ((wp->w_flags & WFLAG_WCOL_OFF_ADDED) == 0) |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3940 { |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3941 wp->w_wcol += left_extra; |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3942 wp->w_flags |= WFLAG_WCOL_OFF_ADDED; |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3943 } |
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3944 if ((wp->w_flags & WFLAG_WROW_OFF_ADDED) == 0) |
19542
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
3945 { |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
3946 wp->w_wrow += top_off; |
22886
38324d4f1c94
patch 8.2.1990: cursor position wrong in terminal popup with finished job
Bram Moolenaar <Bram@vim.org>
parents:
22820
diff
changeset
|
3947 wp->w_flags |= WFLAG_WROW_OFF_ADDED; |
19542
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
3948 } |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3949 |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
3950 total_width = popup_width(wp) - wp->w_popup_rightoff; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
3951 total_height = popup_height(wp); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3952 popup_attr = get_wcr_attr(wp); |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3953 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
3954 if (wp->w_winrow + total_height > cmdline_row) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
3955 wp->w_popup_flags |= POPF_ON_CMDLINE; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
3956 else |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
3957 wp->w_popup_flags &= ~POPF_ON_CMDLINE; |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
3958 |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17545
diff
changeset
|
3959 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3960 // We can only use these line drawing characters when 'encoding' is |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3961 // "utf-8" and 'ambiwidth' is "single". |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3962 if (enc_utf8 && *p_ambw == 's') |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3963 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3964 border_char[0] = border_char[2] = 0x2550; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3965 border_char[1] = border_char[3] = 0x2551; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3966 border_char[4] = 0x2554; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3967 border_char[5] = 0x2557; |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
3968 border_char[6] = (wp->w_popup_flags & POPF_RESIZE) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
3969 ? 0x21f2 : 0x255d; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3970 border_char[7] = 0x255a; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3971 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3972 else |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3973 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3974 border_char[0] = border_char[2] = '-'; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3975 border_char[1] = border_char[3] = '|'; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3976 for (i = 4; i < 8; ++i) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3977 border_char[i] = '+'; |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
3978 if (wp->w_popup_flags & POPF_RESIZE) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17578
diff
changeset
|
3979 border_char[6] = '@'; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3980 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3981 for (i = 0; i < 8; ++i) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3982 if (wp->w_border_char[i] != 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3983 border_char[i] = wp->w_border_char[i]; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3984 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3985 for (i = 0; i < 4; ++i) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3986 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3987 border_attr[i] = popup_attr; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3988 if (wp->w_border_highlight[i] != NULL) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3989 border_attr[i] = syn_name2attr(wp->w_border_highlight[i]); |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3990 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
3991 |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3992 // Title goes on top of border or padding. |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3993 title_wincol = wp->w_wincol + 1; |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3994 if (wp->w_popup_title != NULL) |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
3995 { |
25535
7cb1597067e0
patch 8.2.3304: popup window title with wide characters is truncated
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
3996 title_len = vim_strsize(wp->w_popup_title); |
24709
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
3997 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
3998 // truncate the title if too long |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
3999 if (title_len > total_width - 2) |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4000 { |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4001 int title_byte_len = (int)STRLEN(wp->w_popup_title); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4002 char_u *title_text = alloc(title_byte_len + 1); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4003 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4004 if (title_text != NULL) |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4005 { |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4006 trunc_string(wp->w_popup_title, title_text, |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4007 total_width - 2, title_byte_len + 1); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4008 screen_puts(title_text, wp->w_winrow, title_wincol, |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4009 wp->w_popup_border[0] > 0 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4010 ? border_attr[0] : popup_attr); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4011 vim_free(title_text); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4012 } |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4013 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4014 title_len = total_width - 2; |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4015 } |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4016 else |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
4017 screen_puts(wp->w_popup_title, wp->w_winrow, title_wincol, |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4018 wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr); |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4019 } |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4020 |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4021 wincol = wp->w_wincol - wp->w_popup_leftoff; |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
4022 top_padding = wp->w_popup_padding[0]; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4023 if (wp->w_popup_border[0] > 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4024 { |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4025 // top border; do not draw over the title |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4026 if (title_len > 0) |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4027 { |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4028 screen_fill(wp->w_winrow, wp->w_winrow + 1, |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4029 wincol < 0 ? 0 : wincol, title_wincol, |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4030 wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4031 ? border_char[4] : border_char[0], |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4032 border_char[0], border_attr[0]); |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4033 screen_fill(wp->w_winrow, wp->w_winrow + 1, |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4034 title_wincol + title_len, wincol + total_width, |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4035 border_char[0], border_char[0], border_attr[0]); |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4036 } |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4037 else |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4038 { |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4039 screen_fill(wp->w_winrow, wp->w_winrow + 1, |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4040 wincol < 0 ? 0 : wincol, wincol + total_width, |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4041 wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0 |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4042 ? border_char[4] : border_char[0], |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4043 border_char[0], border_attr[0]); |
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4044 } |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
4045 if (wp->w_popup_border[1] > 0) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4046 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4047 buf[mb_char2bytes(border_char[5], buf)] = NUL; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4048 screen_puts(buf, wp->w_winrow, |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4049 wincol + total_width - 1, border_attr[1]); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4050 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4051 } |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
4052 else if (wp->w_popup_padding[0] == 0 && popup_top_extra(wp) > 0) |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
4053 top_padding = 1; |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4054 |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4055 if (top_padding > 0 || wp->w_popup_padding[2] > 0) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4056 { |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4057 padcol = wincol + wp->w_popup_border[3]; |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4058 padendcol = wp->w_wincol + total_width - wp->w_popup_border[1] |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4059 - wp->w_has_scrollbar; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4060 if (padcol < 0) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4061 { |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4062 padendcol += padcol; |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4063 padcol = 0; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4064 } |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4065 } |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
4066 if (top_padding > 0) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4067 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4068 row = wp->w_winrow + wp->w_popup_border[0]; |
23173
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4069 if (title_len > 0 && row == wp->w_winrow) |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4070 { |
23173
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4071 // top padding and no border; do not draw over the title |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4072 screen_fill(row, row + 1, padcol, title_wincol, |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4073 ' ', ' ', popup_attr); |
23173
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4074 screen_fill(row, row + 1, title_wincol + title_len, |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4075 padendcol, ' ', ' ', popup_attr); |
23173
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4076 row += 1; |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4077 top_padding -= 1; |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4078 } |
23173
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23035
diff
changeset
|
4079 screen_fill(row, row + top_padding, padcol, padendcol, |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4080 ' ', ' ', popup_attr); |
17634
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17626
diff
changeset
|
4081 } |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
4082 |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4083 // Compute scrollbar thumb position and size. |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4084 if (wp->w_has_scrollbar) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4085 { |
18074
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4086 linenr_T linecount = wp->w_buffer->b_ml.ml_line_count; |
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4087 int height = wp->w_height; |
29036
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
4088 int last; |
18074
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4089 |
27453
c7f614c9ceb3
patch 8.2.4255: theoretical computation overflow
Bram Moolenaar <Bram@vim.org>
parents:
26986
diff
changeset
|
4090 sb_thumb_height = ((linenr_T)height * height + linecount / 2) |
c7f614c9ceb3
patch 8.2.4255: theoretical computation overflow
Bram Moolenaar <Bram@vim.org>
parents:
26986
diff
changeset
|
4091 / linecount; |
18074
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4092 if (wp->w_topline > 1 && sb_thumb_height == height) |
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4093 --sb_thumb_height; // scrolled, no full thumb |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4094 if (sb_thumb_height == 0) |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4095 sb_thumb_height = 1; |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
28187
diff
changeset
|
4096 if (linecount <= wp->w_height || wp->w_height == 0) |
17274
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17245
diff
changeset
|
4097 // it just fits, avoid divide by zero |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17245
diff
changeset
|
4098 sb_thumb_top = 0; |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17245
diff
changeset
|
4099 else |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17245
diff
changeset
|
4100 sb_thumb_top = (wp->w_topline - 1 |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17245
diff
changeset
|
4101 + (linecount / wp->w_height) / 2) |
17196
983950357c40
patch 8.1.1597: cannot scroll a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17194
diff
changeset
|
4102 * (wp->w_height - sb_thumb_height) |
983950357c40
patch 8.1.1597: cannot scroll a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17194
diff
changeset
|
4103 / (linecount - wp->w_height); |
18074
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4104 if (wp->w_topline > 1 && sb_thumb_top == 0 && height > 1) |
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4105 sb_thumb_top = 1; // show it's scrolled |
29036
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
4106 last = total_height - top_off - wp->w_popup_border[2]; |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
4107 if (sb_thumb_top >= last) |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
4108 // show at least one character |
29040
5d71ed834c03
patch 8.2.5042: scrollbar thumb in tall scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
4109 sb_thumb_top = last - 1; |
18074
364a9be6a21e
patch 8.1.2032: scrollbar thumb wrong in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18027
diff
changeset
|
4110 |
17202
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4111 if (wp->w_scrollbar_highlight != NULL) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4112 attr_scroll = syn_name2attr(wp->w_scrollbar_highlight); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4113 else |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4114 attr_scroll = highlight_attr[HLF_PSB]; |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4115 if (wp->w_thumb_highlight != NULL) |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4116 attr_thumb = syn_name2attr(wp->w_thumb_highlight); |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4117 else |
4b40e8821f56
patch 8.1.1600: cannot specify highlighting for popup window scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17200
diff
changeset
|
4118 attr_thumb = highlight_attr[HLF_PST]; |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4119 } |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4120 |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4121 for (i = wp->w_popup_border[0]; |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4122 i < total_height - wp->w_popup_border[2]; ++i) |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4123 { |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4124 int pad_left; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4125 // left and right padding only needed next to the body |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4126 int do_padding = |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4127 i >= wp->w_popup_border[0] + wp->w_popup_padding[0] |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4128 && i < total_height - wp->w_popup_border[2] |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4129 - wp->w_popup_padding[2]; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4130 |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4131 row = wp->w_winrow + i; |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4132 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4133 // left border |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4134 if (wp->w_popup_border[3] > 0 && wincol >= 0) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4135 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4136 buf[mb_char2bytes(border_char[3], buf)] = NUL; |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4137 screen_puts(buf, row, wincol, border_attr[3]); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4138 } |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4139 if (do_padding && wp->w_popup_padding[3] > 0) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4140 { |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4141 int col = wincol + wp->w_popup_border[3]; |
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4142 |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4143 // left padding |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4144 pad_left = wp->w_popup_padding[3]; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4145 if (col < 0) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4146 { |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4147 pad_left += col; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4148 col = 0; |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4149 } |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4150 if (pad_left > 0) |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4151 screen_puts(get_spaces(pad_left), row, col, popup_attr); |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4152 } |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4153 // scrollbar |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4154 if (wp->w_has_scrollbar) |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4155 { |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4156 int line = i - top_off; |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4157 int scroll_col = wp->w_wincol + total_width - 1 |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4158 - wp->w_popup_border[1]; |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4159 |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4160 if (line >= 0 && line < wp->w_height) |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4161 screen_putchar(' ', row, scroll_col, |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4162 line >= sb_thumb_top |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4163 && line < sb_thumb_top + sb_thumb_height |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4164 ? attr_thumb : attr_scroll); |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4165 else |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4166 screen_putchar(' ', row, scroll_col, popup_attr); |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
4167 } |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4168 // right border |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4169 if (wp->w_popup_border[1] > 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4170 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4171 buf[mb_char2bytes(border_char[1], buf)] = NUL; |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4172 screen_puts(buf, row, wincol + total_width - 1, border_attr[1]); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4173 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4174 // right padding |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4175 if (do_padding && wp->w_popup_padding[1] > 0) |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4176 screen_puts(get_spaces(wp->w_popup_padding[1]), row, |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4177 wincol + wp->w_popup_border[3] |
17235
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4178 + wp->w_popup_padding[3] + wp->w_width + wp->w_leftcol, |
2a97167854fc
patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents:
17231
diff
changeset
|
4179 popup_attr); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4180 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4181 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4182 if (wp->w_popup_padding[2] > 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4183 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4184 // bottom padding |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4185 row = wp->w_winrow + wp->w_popup_border[0] |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4186 + wp->w_popup_padding[0] + wp->w_height; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4187 screen_fill(row, row + wp->w_popup_padding[2], |
22954
7b0aa7e2274f
patch 8.2.2024: flicker when redrawing a popup with a title and border
Bram Moolenaar <Bram@vim.org>
parents:
22886
diff
changeset
|
4188 padcol, padendcol, ' ', ' ', popup_attr); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4189 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4190 |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4191 if (wp->w_popup_border[2] > 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4192 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4193 // bottom border |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4194 row = wp->w_winrow + total_height - 1; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4195 screen_fill(row , row + 1, |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4196 wincol < 0 ? 0 : wincol, |
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4197 wincol + total_width, |
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4198 wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4199 ? border_char[7] : border_char[2], |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4200 border_char[2], border_attr[2]); |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4201 if (wp->w_popup_border[1] > 0) |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4202 { |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4203 buf[mb_char2bytes(border_char[6], buf)] = NUL; |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4204 screen_puts(buf, row, wincol + total_width - 1, border_attr[2]); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4205 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4206 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4207 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4208 if (wp->w_popup_close == POPCLOSE_BUTTON) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4209 { |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4210 // close button goes on top of anything at the top-right corner |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4211 buf[mb_char2bytes('X', buf)] = NUL; |
17241
3ada3d207b33
patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents:
17235
diff
changeset
|
4212 screen_puts(buf, wp->w_winrow, wincol + total_width - 1, |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4213 wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr); |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4214 } |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
4215 |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
4216 update_popup_transparent(wp, 0); |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
4217 |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4218 // Back to the normal zindex. |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4219 screen_zindex = 0; |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4220 } |
21341
e562f5d1e2a4
patch 8.2.1221: memory leak when updating popup window
Bram Moolenaar <Bram@vim.org>
parents:
21291
diff
changeset
|
4221 |
e562f5d1e2a4
patch 8.2.1221: memory leak when updating popup window
Bram Moolenaar <Bram@vim.org>
parents:
21291
diff
changeset
|
4222 #if defined(FEAT_SEARCH_EXTRA) |
e562f5d1e2a4
patch 8.2.1221: memory leak when updating popup window
Bram Moolenaar <Bram@vim.org>
parents:
21291
diff
changeset
|
4223 // In case win_update() called start_search_hl(). |
e562f5d1e2a4
patch 8.2.1221: memory leak when updating popup window
Bram Moolenaar <Bram@vim.org>
parents:
21291
diff
changeset
|
4224 end_search_hl(); |
e562f5d1e2a4
patch 8.2.1221: memory leak when updating popup window
Bram Moolenaar <Bram@vim.org>
parents:
21291
diff
changeset
|
4225 #endif |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4226 } |
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17051
diff
changeset
|
4227 |
17151
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4228 /* |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4229 * Mark references in callbacks of one popup window. |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4230 */ |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4231 static int |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4232 set_ref_in_one_popup(win_T *wp, int copyID) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4233 { |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4234 int abort = FALSE; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4235 typval_T tv; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4236 |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4237 if (wp->w_close_cb.cb_partial != NULL) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4238 { |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4239 tv.v_type = VAR_PARTIAL; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4240 tv.vval.v_partial = wp->w_close_cb.cb_partial; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4241 abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4242 } |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4243 if (wp->w_filter_cb.cb_partial != NULL) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4244 { |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4245 tv.v_type = VAR_PARTIAL; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4246 tv.vval.v_partial = wp->w_filter_cb.cb_partial; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4247 abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4248 } |
17168
1d30eb64a7a2
patch 8.1.1583: set_ref_in_list() only sets ref in items
Bram Moolenaar <Bram@vim.org>
parents:
17166
diff
changeset
|
4249 abort = abort || set_ref_in_list(wp->w_popup_mask, copyID); |
17151
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4250 return abort; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4251 } |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4252 |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4253 /* |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4254 * Set reference in callbacks of popup windows. |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4255 */ |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4256 int |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4257 set_ref_in_popups(int copyID) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4258 { |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4259 int abort = FALSE; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4260 win_T *wp; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4261 tabpage_T *tp; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4262 |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4263 for (wp = first_popupwin; !abort && wp != NULL; wp = wp->w_next) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4264 abort = abort || set_ref_in_one_popup(wp, copyID); |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4265 |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4266 FOR_ALL_TABPAGES(tp) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4267 { |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4268 for (wp = tp->tp_first_popupwin; !abort && wp != NULL; wp = wp->w_next) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4269 abort = abort || set_ref_in_one_popup(wp, copyID); |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4270 if (abort) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4271 break; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4272 } |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4273 return abort; |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
4274 } |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4275 |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4276 int |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4277 popup_is_popup(win_T *wp) |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4278 { |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4279 return wp->w_popup_flags != 0; |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4280 } |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4281 |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4282 #if defined(FEAT_QUICKFIX) || defined(PROTO) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4283 /* |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4284 * Find an existing popup used as the preview window, in the current tab page. |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4285 * Return NULL if not found. |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4286 */ |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4287 win_T * |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4288 popup_find_preview_window(void) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4289 { |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4290 win_T *wp; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4291 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4292 // Preview window popup is always local to tab page. |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
4293 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4294 if (wp->w_p_pvw) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4295 return wp; |
17545
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4296 return NULL; |
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4297 } |
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4298 |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4299 /* |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4300 * Find an existing popup used as the info window, in the current tab page. |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4301 * Return NULL if not found. |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4302 */ |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4303 win_T * |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4304 popup_find_info_window(void) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4305 { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4306 win_T *wp; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4307 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4308 // info window popup is always local to tab page. |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
4309 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4310 if (wp->w_popup_flags & POPF_INFO) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4311 return wp; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4312 return NULL; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4313 } |
17791
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
4314 #endif |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4315 |
17545
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4316 void |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4317 f_popup_findinfo(typval_T *argvars UNUSED, typval_T *rettv) |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4318 { |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4319 #ifdef FEAT_QUICKFIX |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4320 win_T *wp = popup_find_info_window(); |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4321 |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4322 rettv->vval.v_number = wp == NULL ? 0 : wp->w_id; |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4323 #else |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4324 rettv->vval.v_number = 0; |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4325 #endif |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4326 } |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4327 |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4328 void |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4329 f_popup_findpreview(typval_T *argvars UNUSED, typval_T *rettv) |
17545
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4330 { |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4331 #ifdef FEAT_QUICKFIX |
17545
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4332 win_T *wp = popup_find_preview_window(); |
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4333 |
1e45331bd2ab
patch 8.1.1770: cannot get the window ID of the popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17510
diff
changeset
|
4334 rettv->vval.v_number = wp == NULL ? 0 : wp->w_id; |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4335 #else |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4336 rettv->vval.v_number = 0; |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4337 #endif |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4338 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4339 |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4340 #if defined(FEAT_QUICKFIX) || defined(PROTO) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4341 /* |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4342 * Create a popup to be used as the preview or info window. |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4343 * NOTE: this makes the popup the current window, so that the file can be |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4344 * edited. However, it must not remain to be the current window, the caller |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4345 * must make sure of that. |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4346 */ |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4347 int |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4348 popup_create_preview_window(int info) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4349 { |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4350 win_T *wp = popup_create(NULL, NULL, info ? TYPE_INFO : TYPE_PREVIEW); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4351 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4352 if (wp == NULL) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4353 return FAIL; |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4354 if (info) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4355 wp->w_popup_flags |= POPF_INFO; |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4356 else |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
4357 wp->w_p_pvw = TRUE; |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4358 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4359 // Set the width to a reasonable value, so that w_topline can be computed. |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4360 if (wp->w_minwidth > 0) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4361 wp->w_width = wp->w_minwidth; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4362 else if (wp->w_maxwidth > 0) |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4363 wp->w_width = wp->w_maxwidth; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4364 else |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4365 wp->w_width = curwin->w_width; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4366 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4367 // Will switch to another buffer soon, dummy one can be wiped. |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4368 wp->w_buffer->b_locked = FALSE; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4369 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4370 win_enter(wp, FALSE); |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4371 return OK; |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4372 } |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4373 |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4374 /* |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4375 * Close any preview popup. |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4376 */ |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4377 void |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4378 popup_close_preview(void) |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4379 { |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4380 win_T *wp = popup_find_preview_window(); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4381 |
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4382 if (wp != NULL) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4383 popup_close_with_retval(wp, -1); |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4384 } |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4385 |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4386 /* |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4387 * Hide the info popup. |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4388 */ |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4389 void |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4390 popup_hide_info(void) |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4391 { |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4392 win_T *wp = popup_find_info_window(); |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4393 |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4394 if (wp != NULL) |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4395 popup_hide(wp); |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
4396 } |
21373
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4397 |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4398 /* |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4399 * Close any info popup. |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4400 */ |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4401 void |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4402 popup_close_info(void) |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4403 { |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4404 win_T *wp = popup_find_info_window(); |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4405 |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4406 if (wp != NULL) |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4407 popup_close_with_retval(wp, -1); |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21341
diff
changeset
|
4408 } |
17791
55c167b08c2b
patch 8.1.1892: missing index entry and option menu for 'completepopup'
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
4409 #endif |
17431
ce35cdbe9f74
patch 8.1.1714: cannot preview a file in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
4410 |
17584
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4411 /* |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4412 * Close any popup for a text property associated with "win". |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4413 * Return TRUE if a popup was closed. |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4414 */ |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4415 int |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4416 popup_win_closed(win_T *win) |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4417 { |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4418 int round; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4419 win_T *wp; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4420 win_T *next; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4421 int ret = FALSE; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4422 |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4423 for (round = 1; round <= 2; ++round) |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4424 for (wp = round == 1 ? first_popupwin : curtab->tp_first_popupwin; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4425 wp != NULL; wp = next) |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4426 { |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4427 next = wp->w_next; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4428 if (wp->w_popup_prop_win == win) |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4429 { |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4430 popup_close_with_retval(wp, -1); |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4431 ret = TRUE; |
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4432 } |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4433 } |
17879
5d5b460926ca
patch 8.1.1936: not enough tests for text property popup window
Bram Moolenaar <Bram@vim.org>
parents:
17875
diff
changeset
|
4434 return ret; |
17863
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4435 } |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4436 |
08f1dd29550e
patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
4437 /* |
17584
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4438 * Set the title of the popup window to the file name. |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4439 */ |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4440 void |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4441 popup_set_title(win_T *wp) |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4442 { |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4443 if (wp->w_buffer->b_fname != NULL) |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4444 { |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4445 char_u dirname[MAXPATHL]; |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4446 size_t len; |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4447 |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4448 mch_dirname(dirname, MAXPATHL); |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4449 shorten_buf_fname(wp->w_buffer, dirname, FALSE); |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4450 |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4451 vim_free(wp->w_popup_title); |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4452 len = STRLEN(wp->w_buffer->b_fname) + 3; |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4453 wp->w_popup_title = alloc((int)len); |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4454 if (wp->w_popup_title != NULL) |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4455 vim_snprintf((char *)wp->w_popup_title, len, " %s ", |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4456 wp->w_buffer->b_fname); |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29660
diff
changeset
|
4457 redraw_win_later(wp, UPD_VALID); |
17584
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4458 } |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4459 } |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4460 |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4461 # if defined(FEAT_QUICKFIX) || defined(PROTO) |
17584
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4462 /* |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4463 * If there is a preview window, update the title. |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4464 * Used after changing directory. |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4465 */ |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4466 void |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4467 popup_update_preview_title(void) |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4468 { |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4469 win_T *wp = popup_find_preview_window(); |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4470 |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4471 if (wp != NULL) |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4472 popup_set_title(wp); |
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4473 } |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4474 # endif |
17584
65a8099fc0e8
patch 8.1.1789: cannot see file name of preview popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
4475 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18744
diff
changeset
|
4476 #endif // FEAT_PROP_POPUP |