changeset 689:d7860ee7eb7e v7.0207

updated for version 7.0207
author vimboss
date Sat, 25 Feb 2006 21:55:24 +0000
parents bcd2edc4539e
children 0e922220d322
files runtime/doc/todo.txt runtime/doc/version7.txt src/eval.c src/gui_gtk_x11.c
diffstat 4 files changed, 148 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 24
+*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 25
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,20 +30,17 @@ be worked on, but only if you sponsor Vi
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-Fix for hlsearch getting stuck on multibyte char also in 6.4.  reportec by
-Yukihiro Nakadaira.
-
-
 Tab pages:
+-   Add 'guitablabel' option.
 -   GTK GUI implementation for the tab pages line:
-      /tmp/vim61_tab.patch.bz2
-    Window height can be wrong:
-	:set go-=e
-	resize to fill screen
-	:set go+=e
-    Add 'guitabitem' option?
--   GUI implementation for the tab pages line for other systems.
+    handling of tab in insert mode (like clicking mouse in other window)
+    and cmdline mode (keep current tab)
+
+9   GUI implementation for the tab pages line for other systems.
+8   Make GUI menu in tab pages line configurable.  Like the popup menu.
 8   tab pages in the session file, if "tabpages" in 'sessionoptions'
+8   :tabmove +N	 move tab page N pages forward
+8   :tabmove -N	 move tab page N pages backward
 7   :tabdup	 duplicate the tab with all its windows.
 6   :tab ball    tab page for each buffer
 6   :tab all     tab page for each argument
@@ -136,6 +133,7 @@ all. (Gautam Iyer)
 
 Mac unicode patch (Da Woon Jung):
 - configuration option for platform: i386, ppc or both.
+    Use __LITTLE_ENDIAN__ to test for current platform.
 - selecting proportional font breaks display
 - UTF-8 text causes display problems.  Font replacement causes this.
 - Command-key mappings do not work. (Alan Schmitt)
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Feb 24
+*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Feb 25
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1749,4 +1749,11 @@ short instead of a char to store the col
 
 ml_get errors when searching for "\n\zs" in an empty file.
 
+When selecting a block and using "$" to select until the end of every line and
+not highlighting the character under the cursor the first character of the
+block could be unhighlighted.
+
+When counting words for the Visual block area and using "$" to select until
+the end of every line only up to the length of the last line was counted.
+
  vim:tw=78:ts=8:ft=help:norl:
--- a/src/eval.c
+++ b/src/eval.c
@@ -14943,7 +14943,7 @@ f_tabpagenr(argvars, rettv)
 	if (arg != NULL)
 	{
 	    if (STRCMP(arg, "$") == 0)
-		nr = tabpage_index(NULL);
+		nr = tabpage_index(NULL) - 1;
 	    else
 		EMSG2(_(e_invexpr2), arg);
 	}
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3061,6 +3061,129 @@ set_toolbar_style(GtkToolbar *toolbar)
 
 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
 static int ignore_tabline_evt = FALSE;
+static GtkWidget *tabline_menu;
+static int clicked_page;	    /* page clicked in tab line */
+
+/*
+ * Handle selecting an item in the tab line popup menu.
+ */
+/*ARGSUSED*/
+    static void
+tabline_menu_handler(GtkMenuItem *item, gpointer user_data)
+{
+    char_u	string[3];
+
+    /* Add the string cmd into input buffer */
+    string[0] = CSI;
+    string[1] = KS_TABMENU;
+    string[2] = KE_FILLER;
+    add_to_input_buf(string, 3);
+    string[0] = clicked_page;
+    string[1] = (char_u)(long)user_data;
+    add_to_input_buf_csi(string, 2);
+
+    if (gtk_main_level() > 0)
+	gtk_main_quit();
+}
+
+/*
+ * Send the event for clicking to select tab page "nr".
+ */
+    static void
+send_tabline_event(int nr)
+{
+    char_u string[3];
+
+    string[0] = CSI;
+    string[1] = KS_TABLINE;
+    string[2] = KE_FILLER;
+    add_to_input_buf(string, 3);
+    string[0] = nr;
+    add_to_input_buf_csi(string, 1);
+
+    if (gtk_main_level() > 0)
+	gtk_main_quit();
+}
+
+/*
+ * Create a menu for the tab line.
+ */
+    static GtkWidget *
+create_tabline_menu(void)
+{
+    GtkWidget *menu, *item;
+
+    menu = gtk_menu_new();
+
+    item = gtk_menu_item_new_with_label(_("Close"));
+    gtk_widget_show(item);
+    gtk_container_add(GTK_CONTAINER(menu), item);
+    gtk_signal_connect(GTK_OBJECT(item), "activate",
+	    GTK_SIGNAL_FUNC(tabline_menu_handler),
+	    (gpointer)TABLINE_MENU_CLOSE);
+
+    item = gtk_menu_item_new_with_label(_("New tab"));
+    gtk_widget_show(item);
+    gtk_container_add(GTK_CONTAINER(menu), item);
+    gtk_signal_connect(GTK_OBJECT(item), "activate",
+	    GTK_SIGNAL_FUNC(tabline_menu_handler),
+	    (gpointer)TABLINE_MENU_NEW);
+
+    item = gtk_menu_item_new_with_label(_("Open Tab..."));
+    gtk_widget_show(item);
+    gtk_container_add(GTK_CONTAINER(menu), item);
+    gtk_signal_connect(GTK_OBJECT(item), "activate",
+	    GTK_SIGNAL_FUNC(tabline_menu_handler),
+	    (gpointer)TABLINE_MENU_OPEN);
+
+    return menu;
+}
+
+    static gboolean
+on_tabline_menu(GtkWidget *widget, GdkEvent *event)
+{
+    /* Was this button press event ? */
+    if (event->type == GDK_BUTTON_PRESS)
+    {
+	GdkEventButton *bevent = (GdkEventButton *)event;
+	int		x = bevent->x;
+	GtkWidget	*page;
+	GtkWidget	*label;
+
+	/* Find out where the click was. */
+	for (clicked_page = 1;  ; ++clicked_page)
+	{
+	    page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gui.tabline),
+							    clicked_page - 1);
+	    if (page == NULL)
+	    {
+		/* Past all the labels, return zero. */
+		clicked_page = 0;
+		break;
+	    }
+	    label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page);
+	    /* The label size apparently doesn't include the spacing, estimate
+	     * it by the page position. */
+	    if (page->allocation.x * 2 + label->allocation.x
+					    + label->allocation.width + 1>= x)
+		break;
+	}
+
+	/* If the event was generated for 3rd button popup the menu. */
+	if (bevent->button == 3)
+	{
+	    gtk_menu_popup(GTK_MENU(widget), NULL, NULL, NULL, NULL,
+						bevent->button, bevent->time);
+	    /* We handled the event. */
+	    return TRUE;
+	}
+	else if (bevent->button == 1 && clicked_page == 0)
+	    /* Click after all tabs moves to next tab page. */
+	    send_tabline_event(0);
+    }
+    /* We didn't handle the event. */
+    return FALSE;
+}
 
 /*
  * Handle selecting one of the tabs.
@@ -3073,20 +3196,8 @@ on_select_tab(
 	gint		index,
 	gpointer	data)
 {
-    static char_u string[3];
-
     if (!ignore_tabline_evt)
-    {
-	string[0] = CSI;
-	string[1] = KS_TABLINE;
-	string[2] = KE_FILLER;
-	add_to_input_buf(string, 3);
-	string[0] = index + 1;
-	add_to_input_buf_csi(string, 1);
-
-	if (gtk_main_level() > 0)
-	    gtk_main_quit();
-    }
+	send_tabline_event(index + 1);
 }
 
 /*
@@ -3472,6 +3583,11 @@ gui_mch_init(void)
     }
     gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page",
 		       GTK_SIGNAL_FUNC(on_select_tab), NULL);
+
+    /* Create a popup menu for the tab line and connect it. */
+    tabline_menu = create_tabline_menu();
+    gtk_signal_connect_object(GTK_OBJECT(gui.tabline), "button_press_event",
+		  GTK_SIGNAL_FUNC(on_tabline_menu), GTK_OBJECT(tabline_menu));
 #endif
 
     gui.formwin = gtk_form_new();