[geany/geany] fda8b9: Keep the current tab when closing documents to the right of another tab

Colomban Wendling git-noreply at xxxxx
Mon Sep 18 19:54:23 UTC 2017


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 18 Sep 2017 19:54:23 UTC
Commit:      fda8b97ea634877952acc86d58b75b25537486bb
             https://github.com/geany/geany/commit/fda8b97ea634877952acc86d58b75b25537486bb

Log Message:
-----------
Keep the current tab when closing documents to the right of another tab


Modified Paths:
--------------
    src/notebook.c

Modified: src/notebook.c
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -443,13 +443,16 @@ static void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocume
 {
 	g_return_if_fail(has_tabs_on_right(doc));
 	GtkNotebook *nb = GTK_NOTEBOOK(main_widgets.notebook);
+	gint current_page = gtk_notebook_get_current_page(nb);
 	gint doc_page = document_get_notebook_page(doc);
 	for (gint i = doc_page + 1; i < gtk_notebook_get_n_pages(nb); )
 	{
 		if (! document_close(document_get_from_page(i)))
 			i++; // only increment if tab wasn't closed
 	}
-	gtk_notebook_set_current_page(nb, doc_page);
+	/* keep the current tab to the original one unless it has been closed, in
+	 * which case use the activated one */
+	gtk_notebook_set_current_page(nb, MIN(current_page, doc_page));
 }
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list