Teach --wrap to only indent without wrapping
When a zero or negative width is given to "shortlog -w<width>,<in1>,<in2>" and --format=%[wrap(w,in1,in2)...%], just indent the text by in1 without wrapping. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 18, 2009 at 23:40 UTC
00d3947366a50a06da40989a1fd1e3f99885a4c3
1 file changed
+13
utf8.c
+13
@@ -310,6 +310,19 @@ int strbuf_add_wrapped_text(struct strbuf *buf,
310
int w = indent, assume_utf8 = is_utf8(text);
311
const char *bol = text, *space = NULL;
312
313
+ if (width <= 0) {
314
+ /* just indent */
315
+ while (*text) {
316
+ const char *eol = strchrnul(text, '\n');
317
+ if (*eol == '\n')
318
+ eol++;
319
+ print_spaces(buf, indent);
320
+ strbuf_write(buf, text, eol-text);
321
+ text = eol;
322
+ }
323
+ return 1;
324
+ }
325
+
326
if (indent < 0) {
327
w = -indent;
328
space = text;