Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-10-19 10:40:35 +0400
committerJunio C Hamano <gitster@pobox.com>2009-10-23 10:20:16 +0400
commit00d3947366a50a06da40989a1fd1e3f99885a4c3 (patch)
treee6a9df8e22bee1b5cec207379b358daf0399271f /utf8.c
parenta94410c8134581f2f11a7db838da4d8725911a3c (diff)
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>
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index da996695cc..5c18f0c281 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;