summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-11 20:39:19 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-11 20:39:19 +0100
commit295471920def98ce84bc96e5d97c16d250c81621 (patch)
tree7490f90afb9d639216c80a4942629a19510654ab /src
parent30700cd5ffa258f1d684ab6b34bd03e970450dba (diff)
patch 8.1.0577: tabpage right-click menu never shows "Close tab"v8.1.0577
Problem: Tabpage right-click menu never shows "Close tab". Solution: Always create the "Close tab" item but ignore the event if there is only one tab.
Diffstat (limited to 'src')
-rw-r--r--src/gui.c6
-rw-r--r--src/gui_gtk_x11.c4
-rw-r--r--src/gui_mac.c3
-rw-r--r--src/gui_motif.c23
-rw-r--r--src/version.c2
5 files changed, 19 insertions, 19 deletions
diff --git a/src/gui.c b/src/gui.c
index 2f3bafc97d..9160848c8e 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -3865,10 +3865,14 @@ send_tabline_menu_event(int tabidx, int event)
{
char_u string[3];
- /* Don't put events in the input queue now. */
+ // Don't put events in the input queue now.
if (hold_gui_events)
return;
+ // Cannot close the last tabpage.
+ if (event == TABLINE_MENU_CLOSE && first_tabpage->tp_next == NULL)
+ return;
+
string[0] = CSI;
string[1] = KS_TABMENU;
string[2] = KE_FILLER;
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index dbddb0ffb0..898e2af5f1 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3337,9 +3337,7 @@ create_tabline_menu(void)
GtkWidget *menu;
menu = gtk_menu_new();
- if (first_tabpage->tp_next != NULL)
- add_tabline_menu_item(menu, (char_u *)_("Close tab"),
- TABLINE_MENU_CLOSE);
+ add_tabline_menu_item(menu, (char_u *)_("Close tab"), TABLINE_MENU_CLOSE);
add_tabline_menu_item(menu, (char_u *)_("New tab"), TABLINE_MENU_NEW);
add_tabline_menu_item(menu, (char_u *)_("Open Tab..."), TABLINE_MENU_OPEN);
diff --git a/src/gui_mac.c b/src/gui_mac.c
index 96f04c55a3..ec8ec3adf8 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -6705,8 +6705,7 @@ initialise_tabline(void)
// create tabline popup menu required by vim docs (see :he tabline-menu)
CreateNewMenu(kTabContextMenuId, 0, &contextMenu);
- if (first_tabpage->tp_next != NULL)
- AppendMenuItemTextWithCFString(contextMenu, CFSTR("Close Tab"), 0,
+ AppendMenuItemTextWithCFString(contextMenu, CFSTR("Close Tab"), 0,
TABLINE_MENU_CLOSE, NULL);
AppendMenuItemTextWithCFString(contextMenu, CFSTR("New Tab"), 0,
TABLINE_MENU_NEW, NULL);
diff --git a/src/gui_motif.c b/src/gui_motif.c
index 8467c529d4..b6c140be38 100644
--- a/src/gui_motif.c
+++ b/src/gui_motif.c
@@ -514,21 +514,18 @@ gui_x11_create_widgets(void)
XtVaSetValues(scroller, XmNwidth, 0, XmNresizable, False,
XmNtraversalOn, False, NULL);
- /* Create the tabline popup menu */
+ // Create the tabline popup menu
tabLine_menu = XmCreatePopupMenu(tabLine, "tabline popup", NULL, 0);
- /* Add the buttons to the menu */
- if (first_tabpage->tp_next != NULL)
- {
- n = 0;
- XtSetArg(args[n], XmNuserData, TABLINE_MENU_CLOSE); n++;
- xms = XmStringCreate((char *)"Close tab", STRING_TAG);
- XtSetArg(args[n], XmNlabelString, xms); n++;
- button = XmCreatePushButton(tabLine_menu, "Close", args, n);
- XtAddCallback(button, XmNactivateCallback,
- (XtCallbackProc)tabline_button_cb, NULL);
- XmStringFree(xms);
- }
+ // Add the buttons to the tabline popup menu
+ n = 0;
+ XtSetArg(args[n], XmNuserData, TABLINE_MENU_CLOSE); n++;
+ xms = XmStringCreate((char *)"Close tab", STRING_TAG);
+ XtSetArg(args[n], XmNlabelString, xms); n++;
+ button = XmCreatePushButton(tabLine_menu, "Close", args, n);
+ XtAddCallback(button, XmNactivateCallback,
+ (XtCallbackProc)tabline_button_cb, NULL);
+ XmStringFree(xms);
n = 0;
XtSetArg(args[n], XmNuserData, TABLINE_MENU_NEW); n++;
diff --git a/src/version.c b/src/version.c
index 29fdfb2dd9..0600217c7d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -793,6 +793,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 577,
+/**/
576,
/**/
575,