[geany/geany] 2abf72: Push current position to navqueue before navigating back (#1537)
Vasiliy Faronov
git-noreply at xxxxx
Fri Jul 21 05:59:36 UTC 2017
Branch: refs/heads/master
Author: Vasiliy Faronov <vfaronov at gmail.com>
Committer: elextr <elextr at gmail.com>
Date: Fri, 21 Jul 2017 05:59:36 UTC
Commit: 2abf72a178301c6b90656229bbc11c9eb0b81765
https://github.com/geany/geany/commit/2abf72a178301c6b90656229bbc11c9eb0b81765
Log Message:
-----------
Push current position to navqueue before navigating back (#1537)
Modified Paths:
--------------
src/navqueue.c
Modified: src/navqueue.c
14 lines changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -192,6 +192,20 @@ static gboolean goto_file_pos(const gchar *file, gint pos)
void navqueue_go_back(void)
{
filepos *fprev;
+ GeanyDocument *doc = document_get_current();
+
+ /* If the navqueue is currently at some position A, but the actual cursor is at some other
+ * place B, we should add B to the navqueue, so that (1) we go back to A, not to the next
+ * item in the queue; and (2) we can later restore B by going forward.
+ * (If A = B, add_new_position will ignore it.) */
+ if (doc)
+ {
+ if (doc->file_name)
+ add_new_position(doc->file_name, sci_get_current_position(doc->editor->sci));
+ }
+ else
+ /* see also https://github.com/geany/geany/pull/1537 */
+ g_warning("Attempted navigation when nothing is open");
/* return if theres no place to go back to */
if (g_queue_is_empty(navigation_queue) ||
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list