blob: ca3547cb58bc910c72a7d179dd62e7e6cd2559f4 [file] [log] [blame]
Bram Moolenaar4b779472005-10-04 09:12:31 +00001/* vi:set ts=8 sts=4 sw=4:
2 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 *
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
8 */
9
10/*
11 * popupmenu.c: Popup menu (PUM)
12 */
13#include "vim.h"
14
15#if defined(FEAT_INS_EXPAND) || defined(PROTO)
16
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000017static pumitem_T *pum_array = NULL; /* items of displayed pum */
Bram Moolenaar4b779472005-10-04 09:12:31 +000018static int pum_size; /* nr of items in "pum_array" */
19static int pum_selected; /* index of selected item or -1 */
20static int pum_first = 0; /* index of top item */
21
22static int pum_height; /* nr of displayed pum items */
23static int pum_width; /* width of displayed pum items */
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000024static int pum_base_width; /* width of pum items base */
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000025static int pum_kind_width; /* width of pum items kind column */
Bram Moolenaar4b779472005-10-04 09:12:31 +000026static int pum_scrollbar; /* TRUE when scrollbar present */
27
28static int pum_row; /* top row of pum */
29static int pum_col; /* left column of pum */
30
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000031static int pum_do_redraw = FALSE; /* do redraw anyway */
32
33static int pum_set_selected __ARGS((int n));
34
Bram Moolenaar4b779472005-10-04 09:12:31 +000035#define PUM_DEF_HEIGHT 10
36#define PUM_DEF_WIDTH 15
37
38/*
39 * Show the popup menu with items "array[size]".
40 * "array" must remain valid until pum_undisplay() is called!
41 * When possible the leftmost character is aligned with screen column "col".
42 * The menu appears above the screen line "row" or at "row" + "height" - 1.
43 */
44 void
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000045pum_display(array, size, selected)
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000046 pumitem_T *array;
Bram Moolenaar4b779472005-10-04 09:12:31 +000047 int size;
Bram Moolenaar1f35bf92006-03-07 22:38:47 +000048 int selected; /* index of initially selected item, none if
49 out of range */
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000050{
51 int w;
52 int def_width;
53 int max_width;
54 int kind_width;
55 int extra_width;
56 int i;
57 int top_clear;
Bram Moolenaar4b779472005-10-04 09:12:31 +000058 int row;
59 int height;
60 int col;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000061
62redo:
63 def_width = PUM_DEF_WIDTH;
64 max_width = 0;
65 kind_width = 0;
66 extra_width = 0;
67
Bram Moolenaar1e607892006-03-13 22:15:53 +000068 /* Pretend the pum is already there to avoid that must_redraw is set when
69 * 'cuc' is on. */
70 pum_array = (pumitem_T *)1;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000071 validate_cursor_col();
Bram Moolenaar1e607892006-03-13 22:15:53 +000072 pum_array = NULL;
73
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +000074 row = curwin->w_cline_row + W_WINROW(curwin);
75 height = curwin->w_cline_height;
76 col = curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol;
77
78 if (firstwin->w_p_pvw)
79 top_clear = firstwin->w_height;
80 else
81 top_clear = 0;
Bram Moolenaar4b779472005-10-04 09:12:31 +000082
83 /*
84 * Figure out the size and position of the pum.
85 */
86 if (size < PUM_DEF_HEIGHT)
87 pum_height = size;
88 else
89 pum_height = PUM_DEF_HEIGHT;
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +000090 if (p_ph > 0 && pum_height > p_ph)
91 pum_height = p_ph;
Bram Moolenaar4b779472005-10-04 09:12:31 +000092
93 /* Put the pum below "row" if possible. If there are few lines decide on
94 * where there is more room. */
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +000095 if (row >= cmdline_row - pum_height
96 && row > (cmdline_row - top_clear - height) / 2)
Bram Moolenaar4b779472005-10-04 09:12:31 +000097 {
98 /* pum above "row" */
99 if (row >= size)
100 {
101 pum_row = row - size;
102 pum_height = size;
103 }
104 else
105 {
106 pum_row = 0;
107 pum_height = row;
108 }
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000109 if (p_ph > 0 && pum_height > p_ph)
110 {
111 pum_row += pum_height - p_ph;
112 pum_height = p_ph;
113 }
Bram Moolenaar4b779472005-10-04 09:12:31 +0000114 }
115 else
116 {
117 /* pum below "row" */
118 pum_row = row + height;
119 if (size > cmdline_row - pum_row)
120 pum_height = cmdline_row - pum_row;
121 else
122 pum_height = size;
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000123 if (p_ph > 0 && pum_height > p_ph)
124 pum_height = p_ph;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000125 }
126
127 /* don't display when we only have room for one line */
Bram Moolenaara6557602006-02-04 22:43:20 +0000128 if (pum_height < 1 || (pum_height == 1 && size > 1))
Bram Moolenaar4b779472005-10-04 09:12:31 +0000129 return;
130
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000131 /* If there is a preview window at the top avoid drawing over it. */
132 if (firstwin->w_p_pvw
133 && pum_row < firstwin->w_height
134 && pum_height > firstwin->w_height + 4)
135 {
136 pum_row += firstwin->w_height;
137 pum_height -= firstwin->w_height;
138 }
139
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000140 /* Compute the width of the widest match and the widest extra. */
Bram Moolenaar4b779472005-10-04 09:12:31 +0000141 for (i = 0; i < size; ++i)
142 {
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000143 w = vim_strsize(array[i].pum_text);
Bram Moolenaar4b779472005-10-04 09:12:31 +0000144 if (max_width < w)
145 max_width = w;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000146 if (array[i].pum_kind != NULL)
147 {
148 w = vim_strsize(array[i].pum_kind) + 1;
149 if (kind_width < w)
150 kind_width = w;
151 }
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000152 if (array[i].pum_extra != NULL)
153 {
Bram Moolenaar1e607892006-03-13 22:15:53 +0000154 w = vim_strsize(array[i].pum_extra) + 1;
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000155 if (extra_width < w)
156 extra_width = w;
157 }
Bram Moolenaar4b779472005-10-04 09:12:31 +0000158 }
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000159 pum_base_width = max_width;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000160 pum_kind_width = kind_width;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000161
162 /* if there are more items than room we need a scrollbar */
163 if (pum_height < size)
164 {
165 pum_scrollbar = 1;
166 ++max_width;
167 }
168 else
169 pum_scrollbar = 0;
170
171 if (def_width < max_width)
172 def_width = max_width;
173
174 if (col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
175 {
176 /* align pum column with "col" */
177 pum_col = col;
178 pum_width = Columns - pum_col - pum_scrollbar;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000179 if (pum_width > max_width + kind_width + extra_width + 1
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000180 && pum_width > PUM_DEF_WIDTH)
181 {
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000182 pum_width = max_width + kind_width + extra_width + 1;
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000183 if (pum_width < PUM_DEF_WIDTH)
184 pum_width = PUM_DEF_WIDTH;
185 }
Bram Moolenaar4b779472005-10-04 09:12:31 +0000186 }
187 else if (Columns < def_width)
188 {
189 /* not enough room, will use what we have */
190 pum_col = 0;
191 pum_width = Columns - 1;
192 }
193 else
194 {
195 if (max_width > PUM_DEF_WIDTH)
196 max_width = PUM_DEF_WIDTH; /* truncate */
197 pum_col = Columns - max_width;
198 pum_width = max_width - pum_scrollbar;
199 }
200
201 pum_array = array;
202 pum_size = size;
203
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000204 /* Set selected item and redraw. If the window size changed need to redo
205 * the positioning. */
206 if (pum_set_selected(selected))
207 goto redo;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000208}
209
210/*
211 * Redraw the popup menu, using "pum_first" and "pum_selected".
212 */
213 void
214pum_redraw()
215{
216 int row = pum_row;
217 int col;
218 int attr_norm = highlight_attr[HLF_PNI];
219 int attr_select = highlight_attr[HLF_PSI];
220 int attr_scroll = highlight_attr[HLF_PSB];
221 int attr_thumb = highlight_attr[HLF_PST];
222 int attr;
223 int i;
224 int idx;
225 char_u *s;
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000226 char_u *p = NULL;
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000227 int totwidth, width, w;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000228 int thumb_pos = 0;
229 int thumb_heigth = 1;
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000230 int round;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000231 int n;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000232
233 if (pum_scrollbar)
234 {
235 thumb_heigth = pum_height * pum_height / pum_size;
236 if (thumb_heigth == 0)
237 thumb_heigth = 1;
238 thumb_pos = (pum_first * (pum_height - thumb_heigth)
239 + (pum_size - pum_height) / 2)
240 / (pum_size - pum_height);
241 }
242
243 for (i = 0; i < pum_height; ++i)
244 {
245 idx = i + pum_first;
246 attr = (idx == pum_selected) ? attr_select : attr_norm;
247
248 /* prepend a space if there is room */
249 if (pum_col > 0)
250 screen_putchar(' ', row, pum_col - 1, attr);
251
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000252 /* Display each entry, use two spaces for a Tab.
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000253 * Do this 3 times: For the main text, kind and extra info */
Bram Moolenaar4b779472005-10-04 09:12:31 +0000254 col = pum_col;
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000255 totwidth = 0;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000256 for (round = 1; round <= 3; ++round)
Bram Moolenaar4b779472005-10-04 09:12:31 +0000257 {
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000258 width = 0;
259 s = NULL;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000260 switch (round)
Bram Moolenaar4b779472005-10-04 09:12:31 +0000261 {
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000262 case 1: p = pum_array[idx].pum_text; break;
263 case 2: p = pum_array[idx].pum_kind; break;
264 case 3: p = pum_array[idx].pum_extra; break;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000265 }
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000266 if (p != NULL)
267 for ( ; ; mb_ptr_adv(p))
268 {
269 if (s == NULL)
270 s = p;
271 w = ptr2cells(p);
272 if (*p == NUL || *p == TAB || totwidth + w > pum_width)
273 {
274 /* Display the text that fits or comes before a Tab. */
275 screen_puts_len(s, p - s, row, col, attr);
276 col += width;
277
278 if (*p != TAB)
279 break;
280
281 /* Display two spaces for a Tab. */
282 screen_puts_len((char_u *)" ", 2, row, col, attr);
283 col += 2;
284 totwidth += 2;
285 s = NULL; /* start text at next char */
286 width = 0;
287 }
288 else
289 width += w;
290 }
291
292 if (round > 1)
293 n = pum_kind_width + 1;
294 else
295 n = 1;
296
297 /* Stop when there is nothing more to display. */
298 if (round == 3
299 || (round == 2 && pum_array[idx].pum_extra == NULL)
300 || (round == 1 && pum_array[idx].pum_kind == NULL
301 && pum_array[idx].pum_extra == NULL)
302 || pum_base_width + n >= pum_width)
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000303 break;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000304 screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000305 ' ', ' ', attr);
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000306 col = pum_col + pum_base_width + n;
307 totwidth = pum_base_width + n;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000308 }
309
310 screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr);
311 if (pum_scrollbar > 0)
312 screen_putchar(' ', row, pum_col + pum_width,
313 i >= thumb_pos && i < thumb_pos + thumb_heigth
314 ? attr_thumb : attr_scroll);
315
316 ++row;
317 }
318}
319
320#if 0 /* not used yet */
321/*
322 * Return the index of the currently selected item.
323 */
324 int
325pum_get_selected()
326{
327 return pum_selected;
328}
329#endif
330
331/*
332 * Set the index of the currently selected item. The menu will scroll when
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000333 * necessary. When "n" is out of range don't scroll.
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000334 * Returns TRUE when the window was resized and the location of the popup menu
335 * must be recomputed.
Bram Moolenaar4b779472005-10-04 09:12:31 +0000336 */
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000337 static int
Bram Moolenaar4b779472005-10-04 09:12:31 +0000338pum_set_selected(n)
339 int n;
340{
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000341 int resized = FALSE;
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000342 int context = pum_height / 2;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000343
Bram Moolenaar4b779472005-10-04 09:12:31 +0000344 pum_selected = n;
345
Bram Moolenaar1f35bf92006-03-07 22:38:47 +0000346 if (pum_selected >= 0 && pum_selected < pum_size)
Bram Moolenaar4b779472005-10-04 09:12:31 +0000347 {
Bram Moolenaare3226be2005-12-18 22:10:00 +0000348 if (pum_first > pum_selected - 4)
349 {
350 /* scroll down; when we did a jump it's probably a PageUp then
Bram Moolenaar7df351e2006-01-23 22:30:28 +0000351 * scroll a whole page */
Bram Moolenaare3226be2005-12-18 22:10:00 +0000352 if (pum_first > pum_selected - 2)
353 {
Bram Moolenaar7df351e2006-01-23 22:30:28 +0000354 pum_first -= pum_height - 2;
Bram Moolenaare3226be2005-12-18 22:10:00 +0000355 if (pum_first < 0)
356 pum_first = 0;
Bram Moolenaar7df351e2006-01-23 22:30:28 +0000357 else if (pum_first > pum_selected)
358 pum_first = pum_selected;
Bram Moolenaare3226be2005-12-18 22:10:00 +0000359 }
360 else
361 pum_first = pum_selected;
362 }
363 else if (pum_first < pum_selected - pum_height + 5)
364 {
365 /* scroll up; when we did a jump it's probably a PageDown then
Bram Moolenaar7df351e2006-01-23 22:30:28 +0000366 * scroll a whole page */
Bram Moolenaare3226be2005-12-18 22:10:00 +0000367 if (pum_first < pum_selected - pum_height + 1 + 2)
Bram Moolenaar7df351e2006-01-23 22:30:28 +0000368 {
369 pum_first += pum_height - 2;
370 if (pum_first < pum_selected - pum_height + 1)
371 pum_first = pum_selected - pum_height + 1;
372 }
Bram Moolenaare3226be2005-12-18 22:10:00 +0000373 else
374 pum_first = pum_selected - pum_height + 1;
375 }
Bram Moolenaar4b779472005-10-04 09:12:31 +0000376
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000377 /* Give a few lines of context when possible. */
378 if (context > 3)
379 context = 3;
380 if (pum_height > 2)
Bram Moolenaar4b779472005-10-04 09:12:31 +0000381 {
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000382 if (pum_first > pum_selected - context)
Bram Moolenaar4b779472005-10-04 09:12:31 +0000383 {
384 /* scroll down */
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000385 pum_first = pum_selected - context;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000386 if (pum_first < 0)
387 pum_first = 0;
388 }
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000389 else if (pum_first < pum_selected + context - pum_height + 1)
Bram Moolenaar4b779472005-10-04 09:12:31 +0000390 {
391 /* scroll up */
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000392 pum_first = pum_selected + context - pum_height + 1;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000393 }
394 }
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000395
396#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
397 /* Show extra info in the preview window if there is something and
398 * 'completeopt' contains "preview". */
399 if (pum_array[pum_selected].pum_info != NULL
400 && vim_strchr(p_cot, 'p') != NULL)
401 {
402 win_T *curwin_save = curwin;
403 int res = OK;
404
405 /* Open a preview window. 3 lines by default. */
406 g_do_tagpreview = 3;
407 resized = prepare_tagpreview();
408 g_do_tagpreview = 0;
409
410 if (curwin->w_p_pvw)
411 {
412 if (curbuf->b_fname == NULL
413 && curbuf->b_p_bt[0] == 'n' && curbuf->b_p_bt[2] == 'f'
414 && curbuf->b_p_bh[0] == 'w')
415 {
416 /* Already a "wipeout" buffer, make it empty. */
417 while (!bufempty())
418 ml_delete((linenr_T)1, FALSE);
419 }
420 else if ((res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0))
421 == OK)
422 {
423 /* Edit a new, empty buffer. Set options for a "wipeout"
424 * buffer. */
425 set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
426 set_option_value((char_u *)"bt", 0L, (char_u *)"nofile",
427 OPT_LOCAL);
428 set_option_value((char_u *)"bh", 0L, (char_u *)"wipe",
429 OPT_LOCAL);
430 set_option_value((char_u *)"diff", 0L, (char_u *)"",
431 OPT_LOCAL);
432 }
433 if (res == OK)
434 {
435 char_u *p, *e;
436 linenr_T lnum = 0;
437
438 for (p = pum_array[pum_selected].pum_info; *p != NUL; )
439 {
440 e = vim_strchr(p, '\n');
441 if (e == NULL)
442 {
443 ml_append(lnum++, p, 0, FALSE);
444 break;
445 }
446 else
447 {
448 *e = NUL;
449 ml_append(lnum++, p, e - p + 1, FALSE);
450 *e = '\n';
451 p = e + 1;
452 }
453 }
454
455 /* Increase the height of the preview window to show the
456 * text, but no more than 'previewheight' lines. */
457 if (lnum > p_pvh)
458 lnum = p_pvh;
459 if (curwin->w_height < lnum)
460 {
461 win_setheight((int)lnum);
462 resized = TRUE;
463 }
464
465 curbuf->b_changed = 0;
466 curbuf->b_p_ma = FALSE;
467 curwin->w_cursor.lnum = 0;
468 curwin->w_cursor.col = 0;
469
470 if (curwin != curwin_save && win_valid(curwin_save))
471 {
472 /* Return cursor to where we were */
473 validate_cursor();
Bram Moolenaar600dddc2006-03-12 22:05:10 +0000474 redraw_later(SOME_VALID);
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000475
476 /* When the preview window was resized we need to
477 * update the view on the buffer. Only go back to
478 * the window when needed, otherwise it will always be
479 * redraw. */
480 if (resized)
481 {
482 win_enter(curwin_save, TRUE);
483 update_topline();
484 }
485
486 /* Update the screen before drawing the popup menu.
487 * Enable updating the status lines. */
488 pum_do_redraw = TRUE;
489 update_screen(0);
490 pum_do_redraw = FALSE;
491
492 if (win_valid(curwin_save))
493 win_enter(curwin_save, TRUE);
Bram Moolenaar7d47b6e2006-03-15 22:59:18 +0000494
495 /* May need to update the screen again when there are
496 * autocommands involved. */
497 pum_do_redraw = TRUE;
498 update_screen(0);
499 pum_do_redraw = FALSE;
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000500 }
501 }
502 }
503 }
504#endif
Bram Moolenaar4b779472005-10-04 09:12:31 +0000505 }
506
507 /* Never display more than we have */
508 if (pum_first > pum_size - pum_height)
509 pum_first = pum_size - pum_height;
510
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000511 if (!resized)
512 pum_redraw();
513
514 return resized;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000515}
516
517/*
518 * Undisplay the popup menu (later).
519 */
520 void
521pum_undisplay()
522{
523 pum_array = NULL;
Bram Moolenaar600dddc2006-03-12 22:05:10 +0000524 redraw_all_later(SOME_VALID);
Bram Moolenaar1f4d4de2006-03-14 23:00:46 +0000525 status_redraw_all();
Bram Moolenaar4b779472005-10-04 09:12:31 +0000526}
527
528/*
529 * Clear the popup menu. Currently only resets the offset to the first
530 * displayed item.
531 */
532 void
533pum_clear()
534{
535 pum_first = 0;
536}
537
538/*
539 * Return TRUE if the popup menu is displayed.
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000540 * Overruled when "pum_do_redraw" is set, used to redraw the status lines.
Bram Moolenaar4b779472005-10-04 09:12:31 +0000541 */
542 int
543pum_visible()
544{
Bram Moolenaar96d2c5b2006-03-11 21:27:59 +0000545 return !pum_do_redraw && pum_array != NULL;
Bram Moolenaar4b779472005-10-04 09:12:31 +0000546}
547
Bram Moolenaare3226be2005-12-18 22:10:00 +0000548/*
549 * Return the height of the popup menu, the number of entries visible.
550 * Only valid when pum_visible() returns TRUE!
551 */
552 int
553pum_get_height()
554{
555 return pum_height;
556}
557
Bram Moolenaar4b779472005-10-04 09:12:31 +0000558#endif