Kaydet (Commit) fda8b97e authored tarafından Colomban Wendling's avatar Colomban Wendling

Keep the current tab when closing documents to the right of another tab

üst 87b7e3cf
...@@ -443,13 +443,16 @@ static void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocume ...@@ -443,13 +443,16 @@ static void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocume
{ {
g_return_if_fail(has_tabs_on_right(doc)); g_return_if_fail(has_tabs_on_right(doc));
GtkNotebook *nb = GTK_NOTEBOOK(main_widgets.notebook); GtkNotebook *nb = GTK_NOTEBOOK(main_widgets.notebook);
gint current_page = gtk_notebook_get_current_page(nb);
gint doc_page = document_get_notebook_page(doc); gint doc_page = document_get_notebook_page(doc);
for (gint i = doc_page + 1; i < gtk_notebook_get_n_pages(nb); ) for (gint i = doc_page + 1; i < gtk_notebook_get_n_pages(nb); )
{ {
if (! document_close(document_get_from_page(i))) if (! document_close(document_get_from_page(i)))
i++; // only increment if tab wasn't closed 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));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment