Mercurial > vim
comparison src/popupwin.c @ 17604:506dd2efcbb2 v8.1.1799
patch 8.1.1799: cannot avoid mapping for a popup window
commit https://github.com/vim/vim/commit/749fa0af85232be1d44b77a09161f71cdbace62c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 3 16:18:07 2019 +0200
patch 8.1.1799: cannot avoid mapping for a popup window
Problem: Cannot avoid mapping for a popup window.
Solution: Add the "mapping" property, default TRUE.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Aug 2019 16:30:06 +0200 |
parents | 65a8099fc0e8 |
children | ff097edaae89 |
comparison
equal
deleted
inserted
replaced
17603:3784be49d075 | 17604:506dd2efcbb2 |
---|---|
797 if (callback.cb_name != NULL) | 797 if (callback.cb_name != NULL) |
798 { | 798 { |
799 free_callback(&wp->w_filter_cb); | 799 free_callback(&wp->w_filter_cb); |
800 set_callback(&wp->w_filter_cb, &callback); | 800 set_callback(&wp->w_filter_cb, &callback); |
801 } | 801 } |
802 } | |
803 di = dict_find(dict, (char_u *)"mapping", -1); | |
804 if (di != NULL) | |
805 { | |
806 nr = dict_get_number(dict, (char_u *)"mapping"); | |
807 if (nr) | |
808 wp->w_popup_flags |= POPF_MAPPING; | |
809 else | |
810 wp->w_popup_flags &= ~POPF_MAPPING; | |
802 } | 811 } |
803 | 812 |
804 di = dict_find(dict, (char_u *)"callback", -1); | 813 di = dict_find(dict, (char_u *)"callback", -1); |
805 if (di != NULL) | 814 if (di != NULL) |
806 { | 815 { |
1411 if (wp == NULL) | 1420 if (wp == NULL) |
1412 return NULL; | 1421 return NULL; |
1413 if (rettv != NULL) | 1422 if (rettv != NULL) |
1414 rettv->vval.v_number = wp->w_id; | 1423 rettv->vval.v_number = wp->w_id; |
1415 wp->w_popup_pos = POPPOS_TOPLEFT; | 1424 wp->w_popup_pos = POPPOS_TOPLEFT; |
1416 wp->w_popup_flags = POPF_IS_POPUP; | 1425 wp->w_popup_flags = POPF_IS_POPUP | POPF_MAPPING; |
1417 | 1426 |
1418 if (buf != NULL) | 1427 if (buf != NULL) |
1419 { | 1428 { |
1420 // use existing buffer | 1429 // use existing buffer |
1421 new_buffer = FALSE; | 1430 new_buffer = FALSE; |
1559 if (type == TYPE_DIALOG || type == TYPE_MENU) | 1568 if (type == TYPE_DIALOG || type == TYPE_MENU) |
1560 { | 1569 { |
1561 wp->w_popup_pos = POPPOS_CENTER; | 1570 wp->w_popup_pos = POPPOS_CENTER; |
1562 wp->w_zindex = POPUPWIN_DIALOG_ZINDEX; | 1571 wp->w_zindex = POPUPWIN_DIALOG_ZINDEX; |
1563 wp->w_popup_flags |= POPF_DRAG; | 1572 wp->w_popup_flags |= POPF_DRAG; |
1573 wp->w_popup_flags &= ~POPF_MAPPING; | |
1564 for (i = 0; i < 4; ++i) | 1574 for (i = 0; i < 4; ++i) |
1565 { | 1575 { |
1566 wp->w_popup_border[i] = 1; | 1576 wp->w_popup_border[i] = 1; |
1567 wp->w_popup_padding[i] = (i & 1) ? 1 : 0; | 1577 wp->w_popup_padding[i] = (i & 1) ? 1 : 0; |
1568 } | 1578 } |
2500 | 2510 |
2501 return res; | 2511 return res; |
2502 } | 2512 } |
2503 | 2513 |
2504 /* | 2514 /* |
2515 * Return TRUE if there is a popup visible with a filter callback and the | |
2516 * "mapping" property off. | |
2517 */ | |
2518 int | |
2519 popup_no_mapping(void) | |
2520 { | |
2521 int round; | |
2522 win_T *wp; | |
2523 | |
2524 for (round = 1; round <= 2; ++round) | |
2525 for (wp = round == 1 ? first_popupwin : curtab->tp_first_popupwin; | |
2526 wp != NULL; wp = wp->w_next) | |
2527 if (wp->w_filter_cb.cb_name != NULL | |
2528 && (wp->w_popup_flags & (POPF_HIDDEN | POPF_MAPPING)) == 0) | |
2529 return TRUE; | |
2530 return FALSE; | |
2531 } | |
2532 | |
2533 /* | |
2505 * Called when the cursor moved: check if any popup needs to be closed if the | 2534 * Called when the cursor moved: check if any popup needs to be closed if the |
2506 * cursor moved far enough. | 2535 * cursor moved far enough. |
2507 */ | 2536 */ |
2508 void | 2537 void |
2509 popup_check_cursor_pos() | 2538 popup_check_cursor_pos() |