When closing tab, return to the document at the top of the MRU list
This is a pretty frequent work pattern of mine: 1. Editing file A 2. Searching for function and opening file B 3. Closing file B because I just wanted to look at the function definition 4. Without this patch I get to the file following the B's tab (which is just a random file) but my brain expects that I get to A I know it's possible to kind of simulate the behaviour I want with the "next to current" placement option but I really don't see a single advantage of having tabs closed in sequential order. This is also why I didn't make this behaviour optional. But maybe I miss some use case of tabs being closed sequentially - just tell me. Signed-off-by: Jiří Techet <techet@gmail.com>
This commit is contained in:
parent
0c6aed700d
commit
d0892b95d1
@ -632,7 +632,17 @@ static void on_document_close(GObject *obj, GeanyDocument *doc)
|
||||
{
|
||||
if (! main_status.quitting)
|
||||
{
|
||||
GeanyDocument *last_doc;
|
||||
|
||||
last_doc = g_queue_peek_head(mru_docs);
|
||||
|
||||
if (DOC_VALID(last_doc) && document_get_current() == doc)
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(last_doc));
|
||||
}
|
||||
g_queue_remove(mru_docs, doc);
|
||||
|
||||
g_idle_add(on_idle_close, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -493,15 +493,6 @@ notebook_tab_close_clicked_cb(GtkButton *button, gpointer user_data)
|
||||
/* Always use this instead of gtk_notebook_remove_page(). */
|
||||
void notebook_remove_page(gint page_num)
|
||||
{
|
||||
gint curpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
||||
|
||||
/* Focus the next page, not the previous */
|
||||
if (curpage == page_num && file_prefs.tab_order_ltr)
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), curpage + 1);
|
||||
}
|
||||
|
||||
/* now remove the page (so we don't temporarily switch to the previous page) */
|
||||
gtk_notebook_remove_page(GTK_NOTEBOOK(main_widgets.notebook), page_num);
|
||||
|
||||
tab_count_changed();
|
||||
|
Loading…
x
Reference in New Issue
Block a user