Mercurial > vim
comparison src/popupwin.c @ 17934:0bf8cb0258be v8.1.1963
patch 8.1.1963: popup window filter may be called recursively
Commit: https://github.com/vim/vim/commit/934470e562df7bc778ff916db44918f3ccecc7cc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 1 23:27:05 2019 +0200
patch 8.1.1963: popup window filter may be called recursively
Problem: Popup window filter may be called recursively when using a Normal
mode command.
Solution: Prevent recursiveness. (closes #4887) Also restore KeyTyped.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Sep 2019 23:30:03 +0200 |
parents | ad7a4bd65f20 |
children | ec4248c4b92c |
comparison
equal
deleted
inserted
replaced
17933:209771baa028 | 17934:0bf8cb0258be |
---|---|
2762 * Returns TRUE when the character was consumed, | 2762 * Returns TRUE when the character was consumed, |
2763 */ | 2763 */ |
2764 int | 2764 int |
2765 popup_do_filter(int c) | 2765 popup_do_filter(int c) |
2766 { | 2766 { |
2767 static int recursive = FALSE; | |
2767 int res = FALSE; | 2768 int res = FALSE; |
2768 win_T *wp; | 2769 win_T *wp; |
2770 int save_KeyTyped = KeyTyped; | |
2771 | |
2772 if (recursive) | |
2773 return FALSE; | |
2774 recursive = TRUE; | |
2769 | 2775 |
2770 popup_reset_handled(); | 2776 popup_reset_handled(); |
2771 | 2777 |
2772 if (c == K_LEFTMOUSE) | 2778 if (c == K_LEFTMOUSE) |
2773 { | 2779 { |
2774 int row = mouse_row; | 2780 int row = mouse_row; |
2775 int col = mouse_col; | 2781 int col = mouse_col; |
2776 | 2782 |
2777 wp = mouse_find_win(&row, &col, FIND_POPUP); | 2783 wp = mouse_find_win(&row, &col, FIND_POPUP); |
2778 if (wp != NULL && popup_close_if_on_X(wp, row, col)) | 2784 if (wp != NULL && popup_close_if_on_X(wp, row, col)) |
2779 return TRUE; | 2785 res = TRUE; |
2780 } | 2786 } |
2781 | 2787 |
2782 while (!res && (wp = find_next_popup(FALSE)) != NULL) | 2788 while (!res && (wp = find_next_popup(FALSE)) != NULL) |
2783 if (wp->w_filter_cb.cb_name != NULL) | 2789 if (wp->w_filter_cb.cb_name != NULL) |
2784 res = invoke_popup_filter(wp, c); | 2790 res = invoke_popup_filter(wp, c); |
2785 | 2791 |
2792 recursive = FALSE; | |
2793 KeyTyped = save_KeyTyped; | |
2786 return res; | 2794 return res; |
2787 } | 2795 } |
2788 | 2796 |
2789 /* | 2797 /* |
2790 * Return TRUE if there is a popup visible with a filter callback and the | 2798 * Return TRUE if there is a popup visible with a filter callback and the |