Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Mon, 22 May 2017 13:06:15 UTC Commit: c428a8f4eba44c08deef56ae997d8cce4a48d118 https://github.com/geany/geany-plugins/commit/c428a8f4eba44c08deef56ae997d8c...
Log Message: ----------- git-changebar: Define REMOVED_MARKER_POS() macro and use it to cleanup code
Modified Paths: -------------- git-changebar/src/gcb-plugin.c
Modified: git-changebar/src/gcb-plugin.c 8 lines changed, 5 insertions(+), 3 deletions(-) =================================================================== @@ -73,6 +73,8 @@ PLUGIN_SET_TRANSLATABLE_INFO ( #define DOC_ID_QTAG \ (g_quark_from_string (PLUGIN"/git-doc-id"))
+#define REMOVED_MARKER_POS(pos) \ + ((pos) == 0 ? 0 : (pos) - 1)
enum { MARKER_LINE_ADDED, @@ -745,7 +747,7 @@ diff_hunk_cb (const git_diff_delta *delta, scintilla_send_message (sci, SCI_MARKERADD, line - 1, G_markers[marker].num); } } else { - line = (hunk->new_start == 0) ? 0 : hunk->new_start - 1; + line = REMOVED_MARKER_POS (hunk->new_start); scintilla_send_message (sci, SCI_MARKERADD, line, G_markers[MARKER_LINE_REMOVED].num); } @@ -1061,13 +1063,13 @@ goto_next_hunk_diff_hunk_cb (const git_diff_delta *delta, if (data->next_line >= 0) { return 1; } else if (data->line < hunk->new_start - 1) { - data->next_line = (hunk->new_start == 0) ? 0 : hunk->new_start - 1; + data->next_line = REMOVED_MARKER_POS (hunk->new_start); } break;
case KB_GOTO_PREV_HUNK: if (data->line > hunk->new_start - 1 + MAX (hunk->new_lines - 1, 0)) { - data->next_line = (hunk->new_start == 0) ? 0 : hunk->new_start - 1; + data->next_line = REMOVED_MARKER_POS (hunk->new_start); } break; }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).