codebrainz commented on this pull request.
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); + gtk_notebook_set_current_page(nb, MIN(current_page, doc_page));
Would've saved me a couple minutes of head-scratching if there was a comment that said "keep the current tab unless it was closed, in which case use the activated tab" or something. Maybe I'm just stupid.