SF.net SVN: geany:[5634] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Sun Mar 27 00:18:31 UTC 2011


Revision: 5634
          http://geany.svn.sourceforge.net/geany/?rev=5634&view=rev
Author:   colombanw
Date:     2011-03-27 00:18:31 +0000 (Sun, 27 Mar 2011)

Log Message:
-----------
Don't unsplit when closing the document if we can show another one

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/splitwindow.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-03-27 00:18:18 UTC (rev 5633)
+++ trunk/ChangeLog	2011-03-27 00:18:31 UTC (rev 5634)
@@ -16,6 +16,8 @@
    Brush, thanks! - closes #3097780).
    Fix confusing terminology in Split Window plugin menu labels (patch
    by Matthew Brush - closes #2796316).
+   Don't unsplit when closing the displayed document but rather pick the
+   new current one if any.
 
 
 2011-03-25  Colomban Wendling  <colomban(at)geany(dot)org>

Modified: trunk/plugins/splitwindow.c
===================================================================
--- trunk/plugins/splitwindow.c	2011-03-27 00:18:18 UTC (rev 5633)
+++ trunk/plugins/splitwindow.c	2011-03-27 00:18:31 UTC (rev 5634)
@@ -438,11 +438,31 @@
 }
 
 
+static gboolean do_select_current(gpointer data)
+{
+	GeanyDocument *doc;
+
+	/* guard out for the unlikely case we get called after another unsplitting */
+	if (plugin_state == STATE_UNSPLIT)
+		return FALSE;
+
+	doc = document_get_current();
+	if (DOC_VALID(doc))
+		set_editor(&edit_window, doc->editor);
+	else
+		on_unsplit(NULL, NULL);
+
+	return FALSE;
+}
+
+
 static void on_document_close(GObject *obj, GeanyDocument *doc, gpointer user_data)
 {
-    /* remove the split window because the document won't exist anymore */
 	if (doc->editor == edit_window.editor)
-		on_unsplit(NULL, NULL);
+	{
+		/* select current or unsplit in IDLE time, so the tab has changed */
+		g_idle_add(do_select_current, NULL);
+	}
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list