diff options
author | René Scharfe <l.s.r@web.de> | 2017-11-18 19:05:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-21 09:36:06 +0900 |
commit | 5c3ed90f3f56757f2af9cc327313e9df2e38cdd5 (patch) | |
tree | 18536f2815d684b85023e479758cdd342e54641f /xdiff/xemit.c | |
parent | xdiff: factor out is_func_rec() (diff) | |
download | tgif-5c3ed90f3f56757f2af9cc327313e9df2e38cdd5.tar.xz |
xdiff: show non-empty lines before functions with -W
Non-empty lines before a function definition are most likely comments
for that function and thus relevant. Include them in function context.
Such a non-empty line might also belong to the preceeding function if
there is no separating blank line. Stop extending the context upwards
also at the next function line to make sure only one extra function body
is shown at most.
Original-patch-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff/xemit.c')
-rw-r--r-- | xdiff/xemit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xdiff/xemit.c b/xdiff/xemit.c index c2d5bd004c..7778dc2b19 100644 --- a/xdiff/xemit.c +++ b/xdiff/xemit.c @@ -204,6 +204,9 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, } fs1 = get_func_line(xe, xecfg, NULL, i1, -1); + while (fs1 > 0 && !is_empty_rec(&xe->xdf1, fs1 - 1) && + !is_func_rec(&xe->xdf1, xecfg, fs1 - 1)) + fs1--; if (fs1 < 0) fs1 = 0; if (fs1 < s1) { |