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>
diff --git a/src/autocmd.c b/src/autocmd.c
index c8e51b2..94f9c1f 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1673,7 +1673,7 @@
#endif
(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;
#ifdef FEAT_AUTOCHDIR
p_acd = save_acd;
@@ -1749,7 +1749,7 @@
close_tabpage(curtab);
restore_snapshot(SNAP_AUCMD_IDX, FALSE);
- (void)win_comp_pos(); // recompute window positions
+ win_comp_pos(); // recompute window positions
unblock_autocmds();
save_curwin = win_find_by_id(aco->save_curwin_id);
diff --git a/src/proto/tabpanel.pro b/src/proto/tabpanel.pro
index 34c3e52..617f802 100644
--- a/src/proto/tabpanel.pro
+++ b/src/proto/tabpanel.pro
@@ -1,6 +1,6 @@
/* tabpanel.c */
int tabpanel_width(void);
-int tabpanel_leftcol(win_T *wp);
+int tabpanel_leftcol(void);
int tabpanelopt_changed(void);
void draw_tabpanel(void);
int get_tabpagenr_on_tabpanel(void);
diff --git a/src/proto/window.pro b/src/proto/window.pro
index d92a5af..44e4201 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -72,7 +72,7 @@
void shell_new_columns(void);
void win_size_save(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_setheight(int height);
void win_setheight_win(int height, win_T *win);
diff --git a/src/tabpanel.c b/src/tabpanel.c
index d0f2d15..77fe12f 100644
--- a/src/tabpanel.c
+++ b/src/tabpanel.c
@@ -137,12 +137,9 @@
* Return the offset of a window considering the width of tabpanel.
*/
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();
}
/*
diff --git a/src/testdir/dumps/Test_tabpanel_with_cmdline_pum_0.dump b/src/testdir/dumps/Test_tabpanel_with_cmdline_pum_0.dump
new file mode 100644
index 0000000..e665e25
--- /dev/null
+++ b/src/testdir/dumps/Test_tabpanel_with_cmdline_pum_0.dump
@@ -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
diff --git a/src/testdir/dumps/Test_tabpanel_with_cmdline_pum_1.dump b/src/testdir/dumps/Test_tabpanel_with_cmdline_pum_1.dump
new file mode 100644
index 0000000..0e60b9c
--- /dev/null
+++ b/src/testdir/dumps/Test_tabpanel_with_cmdline_pum_1.dump
@@ -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
diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index 0d79650..1790fee 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -693,4 +693,31 @@
call StopVimInTerminal(buf)
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
diff --git a/src/version.c b/src/version.c
index 64e0e78..6a65d18 100644
--- a/src/version.c
+++ b/src/version.c
@@ -710,6 +710,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1461,
+/**/
1460,
/**/
1459,
diff --git a/src/vim.h b/src/vim.h
index 58ebad3..88caf0b 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -921,10 +921,10 @@
#if defined(FEAT_TABPANEL)
# define COLUMNS_WITHOUT_TPL() (Columns - tabpanel_width())
-# define TPL_LCOL(W) tabpanel_leftcol(W)
+# define TPL_LCOL() tabpanel_leftcol()
#else
# define COLUMNS_WITHOUT_TPL() Columns
-# define TPL_LCOL(W) 0
+# define TPL_LCOL() 0
#endif
#define W_ENDCOL(wp) ((wp)->w_wincol + (wp)->w_width)
diff --git a/src/window.c b/src/window.c
index 52f4b1a..29bcc43 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1434,7 +1434,7 @@
}
if (flags & (WSP_TOP | WSP_BOT))
- (void)win_comp_pos();
+ win_comp_pos();
// Both windows need redrawing. Update all status lines, in case they
// show something related to the window count or position.
@@ -1855,7 +1855,7 @@
frame_fix_width(curwin);
frame_fix_width(wp);
- (void)win_comp_pos(); // recompute window positions
+ win_comp_pos(); // recompute window positions
if (wp->w_buffer != curbuf)
reset_VIsual_and_resel();
@@ -1943,7 +1943,7 @@
frame_fix_width(wp2);
// recompute w_winrow and w_wincol for all windows
- (void)win_comp_pos();
+ win_comp_pos();
}
redraw_all_later(UPD_NOT_VALID);
@@ -1972,7 +1972,7 @@
winframe_remove(wp, &dir, NULL, &unflat_altfr);
win_remove(wp, NULL);
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.
if (win_split_ins(size, flags, wp, dir, unflat_altfr) == FAIL)
@@ -2064,7 +2064,7 @@
win_append(win2, win1);
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);
}
win_enter(win1, FALSE);
@@ -5812,7 +5812,7 @@
*/
if (!hidden)
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();
// position the display and the cursor at the top of the file.
@@ -6177,7 +6177,7 @@
if (!frame_check_height(topframe, h))
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();
curtab->tp_ch_used = p_ch;
@@ -6212,7 +6212,7 @@
if (!frame_check_width(topframe, w))
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)
win_fix_scroll(TRUE);
@@ -6277,7 +6277,7 @@
}
}
// recompute the window positions
- (void)win_comp_pos();
+ win_comp_pos();
}
}
@@ -6286,14 +6286,13 @@
* frames.
* Returns the row just after the last window.
*/
- int
+ void
win_comp_pos(void)
{
int row = tabline_height();
- int col = TPL_LCOL(NULL);
+ int col = TPL_LCOL();
frame_comp_pos(topframe, &row, &col);
- return row;
}
/*
@@ -6592,7 +6591,7 @@
frame_setwidth(wp->w_frame, width + wp->w_vsep_width);
// recompute the window positions
- (void)win_comp_pos();
+ win_comp_pos();
redraw_all_later(UPD_NOT_VALID);
}
@@ -7016,7 +7015,7 @@
else
fr = fr->fr_next;
}
- (void)win_comp_pos();
+ win_comp_pos();
redraw_all_later(UPD_NOT_VALID);
}
@@ -7480,7 +7479,7 @@
{
frame_new_height(fp, fp->fr_height - 1, FALSE, FALSE, FALSE);
frame_fix_height(wp);
- (void)win_comp_pos();
+ win_comp_pos();
}
else
win_new_height(wp, wp->w_height - 1);