[geany/geany] d0892b: When closing tab, return to the document at the top of the MRU list
Jiří Techet
git-noreply at xxxxx
Thu Jul 26 00:02:21 UTC 2012
Branch: refs/heads/document-messages
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sat, 24 Dec 2011 11:29:43
Commit: d0892b95d1ed54a2ab0ce411adff210712573899
https://github.com/geany/geany/commit/d0892b95d1ed54a2ab0ce411adff210712573899
Log Message:
-----------
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 at gmail.com>
Modified Paths:
--------------
src/keybindings.c
src/notebook.c
Modified: src/keybindings.c
10 files changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -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);
}
}
Modified: src/notebook.c
9 files changed, 0 insertions(+), 9 deletions(-)
===================================================================
@@ -493,15 +493,6 @@ gint notebook_new_tab(GeanyDocument *this)
/* 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();
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list