From: Junio C Hamano Date: Mon, 19 Oct 2009 06:40:35 +0000 (-0700) Subject: Teach --wrap to only indent without wrapping X-Git-Tag: v1.6.6-rc0~48^2 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=00d3947366a50a06da40989a1fd1e3f99885a4c3;p=git.git Teach --wrap to only indent without wrapping When a zero or negative width is given to "shortlog -w,," and --format=%[wrap(w,in1,in2)...%], just indent the text by in1 without wrapping. Signed-off-by: Junio C Hamano --- diff --git a/utf8.c b/utf8.c index da996695c..5c18f0c28 100644 --- a/utf8.c +++ b/utf8.c @@ -310,6 +310,19 @@ int strbuf_add_wrapped_text(struct strbuf *buf, int w = indent, assume_utf8 = is_utf8(text); const char *bol = text, *space = NULL; + if (width <= 0) { + /* just indent */ + while (*text) { + const char *eol = strchrnul(text, '\n'); + if (*eol == '\n') + eol++; + print_spaces(buf, indent); + strbuf_write(buf, text, eol-text); + text = eol; + } + return 1; + } + if (indent < 0) { w = -indent; space = text;