PR #3125 (commit 22aac443) broke that accidentally by moving the "switch to last used tab" to a idle callback (g_idle_add()). This runs after opening files from the command line.
Now, the same callback is moved to libmain.c and is only registered when there are no files from the command line.
Additionally, projects gains a private copy of the current_page loaded from the keyfile.
Fixes #3210 You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3267
-- Commit Summary --
* Restore startup behavior to focus files from the command line after session files
-- File Changes --
M src/keyfile.c (40) M src/keyfile.h (4) M src/libmain.c (52) M src/project.c (1) M src/projectprivate.h (1)
-- Patch Links --
https://github.com/geany/geany/pull/3267.patch https://github.com/geany/geany/pull/3267.diff
Looks fine. The notebook page is properly saved and restored across Geany restarts, also for projects, even independently. Great.
While testing I noticed one minor issue though I'm not sure whether it's new or not: when I close a project, the previous session is restored but the "current_page" setting is ignored and not restored.
Similarly, when opening a project, the project specific "current_page" setting is ignored.
Seems to be a regression of this patch. I'm looking at it.
Haven't looked at this, but it may be affected by #3395.
@kugel- pushed 1 commit.
ec327b7c50221039ae90e9df04403fdff95c396a PR #3125 (commit 22aac44) broke that accidentally by moving the
@eht16 commented on this pull request.
@@ -4746,8 +4746,12 @@ gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark)
sci_goto_pos(editor->sci, pos, TRUE); editor->scroll_percent = 0.25F;
- /* finally switch to the page */ - document_show_tab(editor->document); + /* switch to the page, via idle callback in case of batch-opening */ + if (main_status.opening_session_files) + document_show_tab_idle(editor->document);
Maybe we can use `document_show_tab_idle()` unconditionally even for non-batch-opening?
I didn't test but would assume it behaves equally.
Haven't looked at this, but it may be affected by #3395.
I just tested the latest changes and it seems fine for me now. Had only a minor remark but it is not critical at all.
@kugel- commented on this pull request.
@@ -4746,8 +4746,12 @@ gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark)
sci_goto_pos(editor->sci, pos, TRUE); editor->scroll_percent = 0.25F;
- /* finally switch to the page */ - document_show_tab(editor->document); + /* switch to the page, via idle callback in case of batch-opening */ + if (main_status.opening_session_files) + document_show_tab_idle(editor->document);
I thought about it but I hesitated because I wasn't sure if someone (like a plugin) depends on `document_get_current()` returning the switched-to doc immediately after using calling `document_show_tab()` or document_open_*. This also affects the document_open_* functions which internally call `document_show_tab()` via `editor_goto_pos()`.
Fine by me to merge.
Merged #3267 into master.
github-comments@lists.geany.org