[Github-comments] [geany/geany] Push current position to navqueue before navigating back (#1537)

Matthew Brush notifications at xxxxx
Fri Jul 14 22:59:53 UTC 2017


codebrainz commented on this pull request.



> @@ -192,6 +192,14 @@ 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 && doc->file_name)

Personally I don't think it's harmful to include the `NULL` check, but as @kugel- points out, the UI makes it impossible for this code to run if there's no documents open, so as a compromise, I suggested an assertion. That way the check can be excluded from release builds but if the function should ever make it into the plugin API as you mentioned, it will indicate exactly what the problem is to the plugin developer.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1537#discussion_r127564470
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170714/ab9e45d7/attachment.html>


More information about the Github-comments mailing list