Mercurial > vim
comparison src/popupwin.c @ 28778:a8c2bd5fc727 v8.2.4913
patch 8.2.4913: popup_hide() does not always have effect
Commit: https://github.com/vim/vim/commit/27724251bc73f97b55240731f4316ee1b4eac1c5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 8 15:00:04 2022 +0100
patch 8.2.4913: popup_hide() does not always have effect
Problem: Popup_hide() does not always have effect.
Solution: Add the POPF_HIDDEN_FORCE flag. (closes https://github.com/vim/vim/issues/10376)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 08 May 2022 16:15:05 +0200 |
parents | f59db757e4ef |
children | 361b46a07f5e |
comparison
equal
deleted
inserted
replaced
28777:b96ceb97e896 | 28778:a8c2bd5fc727 |
---|---|
976 | 976 |
977 apply_general_options(wp, dict); | 977 apply_general_options(wp, dict); |
978 | 978 |
979 nr = dict_get_bool(dict, (char_u *)"hidden", FALSE); | 979 nr = dict_get_bool(dict, (char_u *)"hidden", FALSE); |
980 if (nr > 0) | 980 if (nr > 0) |
981 wp->w_popup_flags |= POPF_HIDDEN; | 981 wp->w_popup_flags |= POPF_HIDDEN | POPF_HIDDEN_FORCE; |
982 | 982 |
983 // when "firstline" and "cursorline" are both set and the cursor would be | 983 // when "firstline" and "cursorline" are both set and the cursor would be |
984 // above or below the displayed lines, move the cursor to "firstline". | 984 // above or below the displayed lines, move the cursor to "firstline". |
985 if (wp->w_firstline > 0 && (wp->w_popup_flags & POPF_CURSORLINE)) | 985 if (wp->w_firstline > 0 && (wp->w_popup_flags & POPF_CURSORLINE)) |
986 { | 986 { |
2642 return; | 2642 return; |
2643 | 2643 |
2644 id = (int)tv_get_number(argvars); | 2644 id = (int)tv_get_number(argvars); |
2645 wp = find_popup_win(id); | 2645 wp = find_popup_win(id); |
2646 if (wp != NULL) | 2646 if (wp != NULL) |
2647 { | |
2647 popup_hide(wp); | 2648 popup_hide(wp); |
2649 wp->w_popup_flags |= POPF_HIDDEN_FORCE; | |
2650 } | |
2648 } | 2651 } |
2649 | 2652 |
2650 void | 2653 void |
2651 popup_show(win_T *wp) | 2654 popup_show(win_T *wp) |
2652 { | 2655 { |
2672 | 2675 |
2673 id = (int)tv_get_number(argvars); | 2676 id = (int)tv_get_number(argvars); |
2674 wp = find_popup_win(id); | 2677 wp = find_popup_win(id); |
2675 if (wp != NULL) | 2678 if (wp != NULL) |
2676 { | 2679 { |
2680 wp->w_popup_flags &= ~POPF_HIDDEN_FORCE; | |
2677 popup_show(wp); | 2681 popup_show(wp); |
2678 #ifdef FEAT_QUICKFIX | 2682 #ifdef FEAT_QUICKFIX |
2679 if (wp->w_popup_flags & POPF_INFO) | 2683 if (wp->w_popup_flags & POPF_INFO) |
2680 pum_position_info_popup(wp); | 2684 pum_position_info_popup(wp); |
2681 #endif | 2685 #endif |
3604 if (wp->w_popup_prop_type > 0 && win_valid(wp->w_popup_prop_win)) | 3608 if (wp->w_popup_prop_type > 0 && win_valid(wp->w_popup_prop_win)) |
3605 { | 3609 { |
3606 textprop_T prop; | 3610 textprop_T prop; |
3607 linenr_T lnum; | 3611 linenr_T lnum; |
3608 | 3612 |
3609 if (find_visible_prop(wp->w_popup_prop_win, | 3613 if ((wp->w_popup_flags & POPF_HIDDEN_FORCE) == 0 |
3610 wp->w_popup_prop_type, wp->w_popup_prop_id, | 3614 && find_visible_prop(wp->w_popup_prop_win, |
3615 wp->w_popup_prop_type, wp->w_popup_prop_id, | |
3611 &prop, &lnum) == OK) | 3616 &prop, &lnum) == OK) |
3612 { | 3617 { |
3613 wp->w_popup_flags &= ~POPF_HIDDEN; | 3618 wp->w_popup_flags &= ~POPF_HIDDEN; |
3614 wp->w_popup_prop_topline = 0; // force repositioning | 3619 wp->w_popup_prop_topline = 0; // force repositioning |
3615 return TRUE; | 3620 return TRUE; |