changeset 6819:5f24d6d51333 v7.4.731

patch 7.4.731 Problem: The tab menu shows "Close tab" even when it doesn't work. Solution: Don't show "Close tab" for the last tab. (John Marriott)
author Bram Moolenaar <bram@vim.org>
date Tue, 09 Jun 2015 19:14:24 +0200
parents 50b60e51a231
children 41745c0fdee4
files src/gui_gtk_x11.c src/gui_mac.c src/gui_motif.c src/gui_w48.c src/version.c
diffstat 5 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2873,7 +2873,9 @@ create_tabline_menu(void)
     GtkWidget *menu;
 
     menu = gtk_menu_new();
-    add_tabline_menu_item(menu, (char_u *)_("Close"), TABLINE_MENU_CLOSE);
+    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 *)_("New tab"), TABLINE_MENU_NEW);
     add_tabline_menu_item(menu, (char_u *)_("Open Tab..."), TABLINE_MENU_OPEN);
 
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -6819,7 +6819,8 @@ initialise_tabline(void)
 
     // create tabline popup menu required by vim docs (see :he tabline-menu)
     CreateNewMenu(kTabContextMenuId, 0, &contextMenu);
-    AppendMenuItemTextWithCFString(contextMenu, CFSTR("Close"), 0,
+    if (first_tabpage->tp_next != NULL)
+	AppendMenuItemTextWithCFString(contextMenu, CFSTR("Close Tab"), 0,
 						    TABLINE_MENU_CLOSE, NULL);
     AppendMenuItemTextWithCFString(contextMenu, CFSTR("New Tab"), 0,
 						      TABLINE_MENU_NEW, NULL);
--- a/src/gui_motif.c
+++ b/src/gui_motif.c
@@ -540,14 +540,17 @@ gui_x11_create_widgets()
     tabLine_menu = XmCreatePopupMenu(tabLine, "tabline popup", NULL, 0);
 
     /* Add the buttons to the 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);
+    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);
+    }
 
     n = 0;
     XtSetArg(args[n], XmNuserData, TABLINE_MENU_NEW); n++;
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -2389,7 +2389,9 @@ show_tabline_popup_menu(void)
     if (tab_pmenu == NULL)
 	return;
 
-    add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_CLOSE, _("Close tab"));
+    if (first_tabpage->tp_next != NULL)
+        add_tabline_popup_menu_entry(tab_pmenu,
+					  TABLINE_MENU_CLOSE, _("Close tab"));
     add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_NEW, _("New tab"));
     add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_OPEN,
 				 _("Open tab..."));
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    731,
+/**/
     730,
 /**/
     729,