comparison src/popupwin.c @ 17946:ec4248c4b92c v8.1.1969

patch 8.1.1969: popup window filter is used in all modes Commit: https://github.com/vim/vim/commit/581ba39aefe837298a9943b04a1dab13a7ec6772 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 3 22:08:33 2019 +0200 patch 8.1.1969: popup window filter is used in all modes Problem: Popup window filter is used in all modes. Solution: Add the "filtermode" property.
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Sep 2019 22:15:03 +0200
parents 0bf8cb0258be
children 2fdbcecab216
comparison
equal deleted inserted replaced
17945:dffad5c9361e 17946:ec4248c4b92c
841 nr = dict_get_number(dict, (char_u *)"mapping"); 841 nr = dict_get_number(dict, (char_u *)"mapping");
842 if (nr) 842 if (nr)
843 wp->w_popup_flags |= POPF_MAPPING; 843 wp->w_popup_flags |= POPF_MAPPING;
844 else 844 else
845 wp->w_popup_flags &= ~POPF_MAPPING; 845 wp->w_popup_flags &= ~POPF_MAPPING;
846 }
847
848 str = dict_get_string(dict, (char_u *)"filtermode", FALSE);
849 if (str != NULL)
850 {
851 if (STRCMP(str, "a") == 0)
852 wp->w_filter_mode = MODE_ALL;
853 else
854 wp->w_filter_mode = mode_str2flags(str);
846 } 855 }
847 856
848 di = dict_find(dict, (char_u *)"callback", -1); 857 di = dict_find(dict, (char_u *)"callback", -1);
849 if (di != NULL) 858 if (di != NULL)
850 { 859 {
1849 VIM_CLEAR(wp->w_border_highlight[i]); 1858 VIM_CLEAR(wp->w_border_highlight[i]);
1850 for (i = 0; i < 8; ++i) 1859 for (i = 0; i < 8; ++i)
1851 wp->w_border_char[i] = 0; 1860 wp->w_border_char[i] = 0;
1852 wp->w_want_scrollbar = 1; 1861 wp->w_want_scrollbar = 1;
1853 wp->w_popup_fixed = 0; 1862 wp->w_popup_fixed = 0;
1863 wp->w_filter_mode = MODE_ALL;
1854 1864
1855 if (d != NULL) 1865 if (d != NULL)
1856 // Deal with options. 1866 // Deal with options.
1857 apply_options(wp, d); 1867 apply_options(wp, d);
1858 1868
2766 { 2776 {
2767 static int recursive = FALSE; 2777 static int recursive = FALSE;
2768 int res = FALSE; 2778 int res = FALSE;
2769 win_T *wp; 2779 win_T *wp;
2770 int save_KeyTyped = KeyTyped; 2780 int save_KeyTyped = KeyTyped;
2781 int state;
2771 2782
2772 if (recursive) 2783 if (recursive)
2773 return FALSE; 2784 return FALSE;
2774 recursive = TRUE; 2785 recursive = TRUE;
2775 2786
2783 wp = mouse_find_win(&row, &col, FIND_POPUP); 2794 wp = mouse_find_win(&row, &col, FIND_POPUP);
2784 if (wp != NULL && popup_close_if_on_X(wp, row, col)) 2795 if (wp != NULL && popup_close_if_on_X(wp, row, col))
2785 res = TRUE; 2796 res = TRUE;
2786 } 2797 }
2787 2798
2799 state = get_real_state();
2788 while (!res && (wp = find_next_popup(FALSE)) != NULL) 2800 while (!res && (wp = find_next_popup(FALSE)) != NULL)
2789 if (wp->w_filter_cb.cb_name != NULL) 2801 if (wp->w_filter_cb.cb_name != NULL
2802 && (wp->w_filter_mode & state) != 0)
2790 res = invoke_popup_filter(wp, c); 2803 res = invoke_popup_filter(wp, c);
2791 2804
2792 recursive = FALSE; 2805 recursive = FALSE;
2793 KeyTyped = save_KeyTyped; 2806 KeyTyped = save_KeyTyped;
2794 return res; 2807 return res;