comparison src/popupwin.c @ 17771:4bd21046902b v8.1.1882

patch 8.1.1882: cannot specify properties of the info popup window commit https://github.com/vim/vim/commit/62a0cb443c3184f24a6dac73d3505f9056cf6056 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 18 16:35:23 2019 +0200 patch 8.1.1882: cannot specify properties of the info popup window Problem: Cannot specify properties of the info popup window. Solution: Add the 'completepopup' option. Default to PmenuSel highlight.
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Aug 2019 16:45:03 +0200
parents c75da1064e33
children 0f7ae8010787
comparison
equal deleted inserted replaced
17770:eaa74e51248c 17771:4bd21046902b
548 { 548 {
549 char *linehl = "PopupSelected"; 549 char *linehl = "PopupSelected";
550 550
551 if (syn_name2id((char_u *)linehl) == 0) 551 if (syn_name2id((char_u *)linehl) == 0)
552 linehl = "PmenuSel"; 552 linehl = "PmenuSel";
553 sign_define_by_name(sign_name, NULL, 553 sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL);
554 (char_u *)linehl, NULL, NULL);
555 } 554 }
556 555
557 sign_place(&sign_id, (char_u *)"popupmenu", sign_name, 556 sign_place(&sign_id, (char_u *)"popupmenu", sign_name,
558 wp->w_buffer, wp->w_cursor.lnum, SIGN_DEF_PRIO); 557 wp->w_buffer, wp->w_cursor.lnum, SIGN_DEF_PRIO);
559 redraw_win_later(wp, NOT_VALID); 558 redraw_win_later(wp, NOT_VALID);
1284 ml_delete(buf->b_ml.ml_line_count, FALSE); 1283 ml_delete(buf->b_ml.ml_line_count, FALSE);
1285 curbuf = curwin->w_buffer; 1284 curbuf = curwin->w_buffer;
1286 } 1285 }
1287 1286
1288 /* 1287 /*
1289 * Parse the 'previewpopup' option and apply the values to window "wp" if it 1288 * Parse the 'previewpopup' or 'completepopup' option and apply the values to
1290 * not NULL. 1289 * window "wp" if it is not NULL.
1291 * Return FAIL if the parsing fails. 1290 * Return FAIL if the parsing fails.
1292 */ 1291 */
1293 int 1292 static int
1294 parse_previewpopup(win_T *wp) 1293 parse_popup_option(win_T *wp, int is_preview)
1295 { 1294 {
1296 char_u *p; 1295 char_u *p;
1297 1296
1298 for (p = p_pvp; *p != NUL; p += (*p == ',' ? 1 : 0)) 1297 for (p = is_preview ? p_pvp : p_cpp; *p != NUL; p += (*p == ',' ? 1 : 0))
1299 { 1298 {
1300 char_u *e, *dig; 1299 char_u *e, *dig;
1301 char_u *s = p; 1300 char_u *s = p;
1302 int x; 1301 int x;
1303 1302
1308 p = vim_strchr(e, ','); 1307 p = vim_strchr(e, ',');
1309 if (p == NULL) 1308 if (p == NULL)
1310 p = e + STRLEN(e); 1309 p = e + STRLEN(e);
1311 dig = e + 1; 1310 dig = e + 1;
1312 x = getdigits(&dig); 1311 x = getdigits(&dig);
1313 if (dig != p)
1314 return FAIL;
1315 1312
1316 if (STRNCMP(s, "height:", 7) == 0) 1313 if (STRNCMP(s, "height:", 7) == 0)
1317 { 1314 {
1315 if (dig != p)
1316 return FAIL;
1318 if (wp != NULL) 1317 if (wp != NULL)
1319 { 1318 {
1320 wp->w_minheight = x; 1319 if (is_preview)
1320 wp->w_minheight = x;
1321 wp->w_maxheight = x; 1321 wp->w_maxheight = x;
1322 } 1322 }
1323 } 1323 }
1324 else if (STRNCMP(s, "width:", 6) == 0) 1324 else if (STRNCMP(s, "width:", 6) == 0)
1325 { 1325 {
1326 if (dig != p)
1327 return FAIL;
1326 if (wp != NULL) 1328 if (wp != NULL)
1327 { 1329 {
1328 wp->w_minwidth = x; 1330 if (is_preview)
1331 wp->w_minwidth = x;
1329 wp->w_maxwidth = x; 1332 wp->w_maxwidth = x;
1330 } 1333 }
1331 } 1334 }
1335 else if (STRNCMP(s, "highlight:", 10) == 0)
1336 {
1337 if (wp != NULL)
1338 {
1339 int c = *p;
1340
1341 *p = NUL;
1342 set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1,
1343 s + 10, OPT_FREE|OPT_LOCAL, 0);
1344 *p = c;
1345 }
1346 }
1332 else 1347 else
1333 return FAIL; 1348 return FAIL;
1334 } 1349 }
1335 return OK; 1350 return OK;
1351 }
1352
1353 /*
1354 * Parse the 'previewpopup' option and apply the values to window "wp" if it
1355 * is not NULL.
1356 * Return FAIL if the parsing fails.
1357 */
1358 int
1359 parse_previewpopup(win_T *wp)
1360 {
1361 return parse_popup_option(wp, TRUE);
1362 }
1363
1364 /*
1365 * Parse the 'completepopup' option and apply the values to window "wp" if it
1366 * is not NULL.
1367 * Return FAIL if the parsing fails.
1368 */
1369 int
1370 parse_completepopup(win_T *wp)
1371 {
1372 return parse_popup_option(wp, FALSE);
1336 } 1373 }
1337 1374
1338 /* 1375 /*
1339 * Set w_wantline and w_wantcol for the cursor position in the current window. 1376 * Set w_wantline and w_wantcol for the cursor position in the current window.
1340 * Keep at least "width" columns from the right of the screen. 1377 * Keep at least "width" columns from the right of the screen.
1639 { 1676 {
1640 wp->w_popup_pos = POPPOS_TOPLEFT; 1677 wp->w_popup_pos = POPPOS_TOPLEFT;
1641 wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE; 1678 wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE;
1642 wp->w_popup_close = POPCLOSE_BUTTON; 1679 wp->w_popup_close = POPCLOSE_BUTTON;
1643 add_border_left_right_padding(wp); 1680 add_border_left_right_padding(wp);
1681 parse_completepopup(wp);
1644 } 1682 }
1645 1683
1646 for (i = 0; i < 4; ++i) 1684 for (i = 0; i < 4; ++i)
1647 VIM_CLEAR(wp->w_border_highlight[i]); 1685 VIM_CLEAR(wp->w_border_highlight[i]);
1648 for (i = 0; i < 8; ++i) 1686 for (i = 0; i < 8; ++i)