From d20313e3daf855ee5d4808e050f54614c200d7b1 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 10 Jun 2010 20:15:51 +0200 Subject: ui-diff: Add links to increase/decrease number of context lines in diffs Add two links to the "Diffstat" line to show more/less context lines in the generated diff. To support this, cgit_commit_link() and cgit_diff_link() has learned to preserve the ctx.qry.context variable. Signed-off-by: Johan Herland Signed-off-by: Lars Hjemli --- ui-diff.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ui-diff.c') diff --git a/ui-diff.c b/ui-diff.c index d3a3b2c..e0a72f7 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -156,13 +156,21 @@ static void inspect_filepair(struct diff_filepair *pair) void cgit_print_diffstat(const unsigned char *old_sha1, const unsigned char *new_sha1, const char *prefix) { - int i; + int i, save_context = ctx.qry.context; html("
"); cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, ctx.qry.sha2, NULL, 0); if (prefix) htmlf(" (limited to '%s')", prefix); + html(" ("); + ctx.qry.context = (save_context > 0 ? save_context : 3) << 1; + cgit_self_link("more", NULL, NULL, &ctx); + html("/"); + ctx.qry.context = (save_context > 3 ? save_context : 3) >> 1; + cgit_self_link("less", NULL, NULL, &ctx); + ctx.qry.context = save_context; + html(" context)"); html("
"); html(""); max_changes = 0; -- cgit v1.2.3-59-g8ed1b