0
0
mirror of https://github.com/vim/vim.git synced 2025-10-24 08:54:47 -04:00

patch 9.1.1461: tabpanel: tabpanel vanishes with popup menu

Problem:  tabpanel: tabpanel vanishes with popup menu
Solution: remove pum-related test in tabpanel_leftcol(), refactor a few
          related functions (Hirohito Higashi)

This commit does the following:
- Delete unnecessary pum-related checks in the tabpanel_leftcol()
  function
- remove pum-related check in tabpanel_leftcol()
- The argument of the TPL_LCOL() macro has been deleted.
- The argument of the tabpanel_leftcol() function has been changed
  to void
- The return type of the `win_comp_pos()` function has been changed to
  void

closes: #17549

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2025-06-16 19:39:24 +02:00
committed by Christian Brabandt
parent e5297e39b3
commit e5c96e344c
10 changed files with 71 additions and 26 deletions

View File

@@ -1673,7 +1673,7 @@ aucmd_prepbuf(
#endif #endif
(void)win_split_ins(0, WSP_TOP | WSP_FORCE_ROOM, auc_win, 0, NULL); (void)win_split_ins(0, WSP_TOP | WSP_FORCE_ROOM, auc_win, 0, NULL);
(void)win_comp_pos(); // recompute window positions win_comp_pos(); // recompute window positions
p_ea = save_ea; p_ea = save_ea;
#ifdef FEAT_AUTOCHDIR #ifdef FEAT_AUTOCHDIR
p_acd = save_acd; p_acd = save_acd;
@@ -1749,7 +1749,7 @@ win_found:
close_tabpage(curtab); close_tabpage(curtab);
restore_snapshot(SNAP_AUCMD_IDX, FALSE); restore_snapshot(SNAP_AUCMD_IDX, FALSE);
(void)win_comp_pos(); // recompute window positions win_comp_pos(); // recompute window positions
unblock_autocmds(); unblock_autocmds();
save_curwin = win_find_by_id(aco->save_curwin_id); save_curwin = win_find_by_id(aco->save_curwin_id);

View File

@@ -1,6 +1,6 @@
/* tabpanel.c */ /* tabpanel.c */
int tabpanel_width(void); int tabpanel_width(void);
int tabpanel_leftcol(win_T *wp); int tabpanel_leftcol(void);
int tabpanelopt_changed(void); int tabpanelopt_changed(void);
void draw_tabpanel(void); void draw_tabpanel(void);
int get_tabpagenr_on_tabpanel(void); int get_tabpagenr_on_tabpanel(void);

View File

@@ -72,7 +72,7 @@ void shell_new_rows(void);
void shell_new_columns(void); void shell_new_columns(void);
void win_size_save(garray_T *gap); void win_size_save(garray_T *gap);
void win_size_restore(garray_T *gap); void win_size_restore(garray_T *gap);
int win_comp_pos(void); void win_comp_pos(void);
void win_ensure_size(void); void win_ensure_size(void);
void win_setheight(int height); void win_setheight(int height);
void win_setheight_win(int height, win_T *win); void win_setheight_win(int height, win_T *win);

View File

@@ -137,11 +137,8 @@ tabpanel_width(void)
* Return the offset of a window considering the width of tabpanel. * Return the offset of a window considering the width of tabpanel.
*/ */
int int
tabpanel_leftcol(win_T *wp) tabpanel_leftcol(void)
{ {
if (cmdline_pum_active() || (wp != NULL && WIN_IS_POPUP(wp)))
return 0;
else
return tpl_align == ALIGN_RIGHT ? 0 : tabpanel_width(); return tpl_align == ALIGN_RIGHT ? 0 : tabpanel_width();
} }

View File

@@ -0,0 +1,10 @@
|[+8#0000001#e0e0e08|N|o| |N|a|m|e|]| @11|[|N|o| |N|a|m|e|]| | +2#0000000#ffffff0|a@2| | +1&&@7|X+8#0000001#e0e0e08
|a+2#0000000#ffffff0@2| @16> +0&&@24
| +1&&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +0#0000000&@44

View File

@@ -0,0 +1,10 @@
|[+8#0000001#e0e0e08|N|o| |N|a|m|e|]| @12|N|a|m|e|]| @1|a@2| | +2#0000000#ffffff0|b@2| | +1&&@5|X+8#0000001#e0e0e08
|a@2| @16| +0#0000000#ffffff0@24
|b+2&&@2| @16|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +1#0000000&@19|~+0#4040ff13&| @23
| +0#0000001#e0e0e08|s|e|t| @11| +1#0000000#ffffff0@3|~+0#4040ff13&| @23
| +0#0000001#ffd7ff255|s|e|t|f|i|l|e|t|y|p|e| @3| +1#0000000#ffffff0@3|~+0#4040ff13&| @23
| +0#0000001#ffd7ff255|s|e|t|g|l|o|b|a|l| @5| +1#0000000#ffffff0@3|~+0#4040ff13&| @23
| +0#0000001#ffd7ff255|s|e|t|l|o|c|a|l| @6| +1#0000000#ffffff0@3|~+0#4040ff13&| @23
|:+0#0000000&|s|e|t> @40

View File

@@ -693,4 +693,31 @@ function Test_tabpanel_with_msg_scrolled()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc
function Test_tabpanel_with_cmdline_pum()
CheckScreendump
let lines =<< trim END
set showtabpanel=2
set noruler
tabnew aaa
set wildoptions+=pum
func TimerCb(timer)
tabnew bbb
endfunc
call timer_start(100, 'TimerCb')
END
call writefile(lines, 'XTest_tabpanel_with_cmdline_pum', 'D')
let buf = RunVimInTerminal('-S XTest_tabpanel_with_cmdline_pum', {'rows': 10, 'cols': 45})
call term_sendkeys(buf, "\<C-L>")
call VerifyScreenDump(buf, 'Test_tabpanel_with_cmdline_pum_0', {})
call term_sendkeys(buf, ":set\<Tab>")
call term_wait(buf, 120)
call VerifyScreenDump(buf, 'Test_tabpanel_with_cmdline_pum_1', {})
call term_sendkeys(buf, "\<Esc>:tabclose\<CR>\<C-L>")
call VerifyScreenDump(buf, 'Test_tabpanel_with_cmdline_pum_0', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -709,6 +709,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1461,
/**/ /**/
1460, 1460,
/**/ /**/

View File

@@ -921,10 +921,10 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
#if defined(FEAT_TABPANEL) #if defined(FEAT_TABPANEL)
# define COLUMNS_WITHOUT_TPL() (Columns - tabpanel_width()) # define COLUMNS_WITHOUT_TPL() (Columns - tabpanel_width())
# define TPL_LCOL(W) tabpanel_leftcol(W) # define TPL_LCOL() tabpanel_leftcol()
#else #else
# define COLUMNS_WITHOUT_TPL() Columns # define COLUMNS_WITHOUT_TPL() Columns
# define TPL_LCOL(W) 0 # define TPL_LCOL() 0
#endif #endif
#define W_ENDCOL(wp) ((wp)->w_wincol + (wp)->w_width) #define W_ENDCOL(wp) ((wp)->w_wincol + (wp)->w_width)

View File

@@ -1434,7 +1434,7 @@ win_split_ins(
} }
if (flags & (WSP_TOP | WSP_BOT)) if (flags & (WSP_TOP | WSP_BOT))
(void)win_comp_pos(); win_comp_pos();
// Both windows need redrawing. Update all status lines, in case they // Both windows need redrawing. Update all status lines, in case they
// show something related to the window count or position. // show something related to the window count or position.
@@ -1855,7 +1855,7 @@ win_exchange(long Prenum)
frame_fix_width(curwin); frame_fix_width(curwin);
frame_fix_width(wp); frame_fix_width(wp);
(void)win_comp_pos(); // recompute window positions win_comp_pos(); // recompute window positions
if (wp->w_buffer != curbuf) if (wp->w_buffer != curbuf)
reset_VIsual_and_resel(); reset_VIsual_and_resel();
@@ -1943,7 +1943,7 @@ win_rotate(int upwards, int count)
frame_fix_width(wp2); frame_fix_width(wp2);
// recompute w_winrow and w_wincol for all windows // recompute w_winrow and w_wincol for all windows
(void)win_comp_pos(); win_comp_pos();
} }
redraw_all_later(UPD_NOT_VALID); redraw_all_later(UPD_NOT_VALID);
@@ -1972,7 +1972,7 @@ win_splitmove(win_T *wp, int size, int flags)
winframe_remove(wp, &dir, NULL, &unflat_altfr); winframe_remove(wp, &dir, NULL, &unflat_altfr);
win_remove(wp, NULL); win_remove(wp, NULL);
last_status(FALSE); // may need to remove last status line last_status(FALSE); // may need to remove last status line
(void)win_comp_pos(); // recompute window positions win_comp_pos(); // recompute window positions
// Split a window on the desired side and put "wp" there. // Split a window on the desired side and put "wp" there.
if (win_split_ins(size, flags, wp, dir, unflat_altfr) == FAIL) if (win_split_ins(size, flags, wp, dir, unflat_altfr) == FAIL)
@@ -2064,7 +2064,7 @@ win_move_after(win_T *win1, win_T *win2)
win_append(win2, win1); win_append(win2, win1);
frame_append(win2->w_frame, win1->w_frame); frame_append(win2->w_frame, win1->w_frame);
(void)win_comp_pos(); // recompute w_winrow for all windows win_comp_pos(); // recompute w_winrow for all windows
redraw_later(UPD_NOT_VALID); redraw_later(UPD_NOT_VALID);
} }
win_enter(win1, FALSE); win_enter(win1, FALSE);
@@ -5812,7 +5812,7 @@ win_alloc(win_T *after, int hidden)
*/ */
if (!hidden) if (!hidden)
win_append(after, new_wp); win_append(after, new_wp);
new_wp->w_wincol = TPL_LCOL(NULL); new_wp->w_wincol = TPL_LCOL();
new_wp->w_width = COLUMNS_WITHOUT_TPL(); new_wp->w_width = COLUMNS_WITHOUT_TPL();
// position the display and the cursor at the top of the file. // position the display and the cursor at the top of the file.
@@ -6177,7 +6177,7 @@ shell_new_rows(void)
if (!frame_check_height(topframe, h)) if (!frame_check_height(topframe, h))
frame_new_height(topframe, h, FALSE, FALSE, FALSE); frame_new_height(topframe, h, FALSE, FALSE, FALSE);
(void)win_comp_pos(); // recompute w_winrow and w_wincol win_comp_pos(); // recompute w_winrow and w_wincol
compute_cmdrow(); compute_cmdrow();
curtab->tp_ch_used = p_ch; curtab->tp_ch_used = p_ch;
@@ -6212,7 +6212,7 @@ shell_new_columns(void)
if (!frame_check_width(topframe, w)) if (!frame_check_width(topframe, w))
frame_new_width(topframe, w, FALSE, FALSE); frame_new_width(topframe, w, FALSE, FALSE);
(void)win_comp_pos(); // recompute w_winrow and w_wincol win_comp_pos(); // recompute w_winrow and w_wincol
if (!skip_win_fix_scroll) if (!skip_win_fix_scroll)
win_fix_scroll(TRUE); win_fix_scroll(TRUE);
@@ -6277,7 +6277,7 @@ win_size_restore(garray_T *gap)
} }
} }
// recompute the window positions // recompute the window positions
(void)win_comp_pos(); win_comp_pos();
} }
} }
@@ -6286,14 +6286,13 @@ win_size_restore(garray_T *gap)
* frames. * frames.
* Returns the row just after the last window. * Returns the row just after the last window.
*/ */
int void
win_comp_pos(void) win_comp_pos(void)
{ {
int row = tabline_height(); int row = tabline_height();
int col = TPL_LCOL(NULL); int col = TPL_LCOL();
frame_comp_pos(topframe, &row, &col); frame_comp_pos(topframe, &row, &col);
return row;
} }
/* /*
@@ -6592,7 +6591,7 @@ win_setwidth_win(int width, win_T *wp)
frame_setwidth(wp->w_frame, width + wp->w_vsep_width); frame_setwidth(wp->w_frame, width + wp->w_vsep_width);
// recompute the window positions // recompute the window positions
(void)win_comp_pos(); win_comp_pos();
redraw_all_later(UPD_NOT_VALID); redraw_all_later(UPD_NOT_VALID);
} }
@@ -7016,7 +7015,7 @@ win_drag_vsep_line(win_T *dragwin, int offset)
else else
fr = fr->fr_next; fr = fr->fr_next;
} }
(void)win_comp_pos(); win_comp_pos();
redraw_all_later(UPD_NOT_VALID); redraw_all_later(UPD_NOT_VALID);
} }
@@ -7480,7 +7479,7 @@ last_status_rec(frame_T *fr, int statusline)
{ {
frame_new_height(fp, fp->fr_height - 1, FALSE, FALSE, FALSE); frame_new_height(fp, fp->fr_height - 1, FALSE, FALSE, FALSE);
frame_fix_height(wp); frame_fix_height(wp);
(void)win_comp_pos(); win_comp_pos();
} }
else else
win_new_height(wp, wp->w_height - 1); win_new_height(wp, wp->w_height - 1);