Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Wed, 22 May 2013 18:33:39 UTC Commit: 1996aaa20c60d106900be8e7a99a0ff813ac3bc4 https://github.com/geany/geany-plugins/commit/1996aaa20c60d106900be8e7a99a0f...
Log Message: ----------- pohelper: Fix going to the next untranslated or fuzzy string
Correctly handle the case where there is either no next untranslated or no next fuzzily translated messages, in which case pos1 or pos2 might be -1, and so MIN() would return -1 even if one of the values was positive.
Modified Paths: -------------- pohelper/src/gph-plugin.c
Modified: pohelper/src/gph-plugin.c 16 files changed, 12 insertions(+), 4 deletions(-) =================================================================== @@ -76,6 +76,12 @@ enum { (doc)->file_type->id == GEANY_FILETYPES_PO)
+/* gets the smallest valid position between @a and @b */ +#define MIN_POS(a, b) ((a) < 0 ? (b) : (b) < 0 ? (a) : MIN ((a), (b))) +/* gets the highest valid position between @a and @b */ +#define MAX_POS(a, b) (MAX ((a), (b))) + + /* * find_style: * @sci: a #ScintillaObject @@ -371,9 +377,10 @@ enum { if (doc_is_po (doc)) { gint pos1 = find_prev_untranslated (doc); gint pos2 = find_prev_fuzzy (doc); + gint pos = MAX_POS (pos1, pos2);
- if (pos1 >= 0 || pos2 >= 0) { - editor_goto_pos (doc->editor, MAX (pos1, pos2), FALSE); + if (pos >= 0) { + editor_goto_pos (doc->editor, pos, FALSE); } } } @@ -384,9 +391,10 @@ enum { if (doc_is_po (doc)) { gint pos1 = find_next_untranslated (doc); gint pos2 = find_next_fuzzy (doc); + gint pos = MIN_POS (pos1, pos2);
- if (pos1 >= 0 || pos2 >= 0) { - editor_goto_pos (doc->editor, MIN (pos1, pos2), FALSE); + if (pos >= 0) { + editor_goto_pos (doc->editor, pos, FALSE); } } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org