summaryrefslogtreecommitdiff
path: root/add-patch.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-12-13 08:07:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-13 20:37:13 (GMT)
commit12c24cf850d280dd08dfe7361603b7089007fe3a (patch)
tree40eb094ccad9ca8dd0b9eda8598315f3ce2cac83 /add-patch.c
parent25ea47af494c5ec086aae102d358c4001c9a1459 (diff)
downloadgit-12c24cf850d280dd08dfe7361603b7089007fe3a.zip
git-12c24cf850d280dd08dfe7361603b7089007fe3a.tar.gz
git-12c24cf850d280dd08dfe7361603b7089007fe3a.tar.bz2
built-in add -p: color the prompt and the help text
... just like the Perl version ;-) Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/add-patch.c b/add-patch.c
index e266a96..dab2ff2 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -334,9 +334,12 @@ static int patch_update_file(struct add_p_state *s)
strbuf_addstr(&s->buf, ",j");
if (hunk_index + 1 < s->hunk_nr)
strbuf_addstr(&s->buf, ",J");
- printf("(%"PRIuMAX"/%"PRIuMAX") ",
- (uintmax_t)hunk_index + 1, (uintmax_t)s->hunk_nr);
- printf(_("Stage this hunk [y,n,a,d%s,?]? "), s->buf.buf);
+ color_fprintf(stdout, s->s.prompt_color,
+ "(%"PRIuMAX"/%"PRIuMAX") ",
+ (uintmax_t)hunk_index + 1, (uintmax_t)s->hunk_nr);
+ color_fprintf(stdout, s->s.prompt_color,
+ _("Stage this hunk [y,n,a,d%s,?]? "),
+ s->buf.buf);
fflush(stdout);
if (strbuf_getline(&s->answer, stdin) == EOF)
break;
@@ -376,7 +379,8 @@ soft_increment:
else if (undecided_next >= 0 && s->answer.buf[0] == 'j')
hunk_index = undecided_next;
else
- puts(_(help_patch_text));
+ color_fprintf(stdout, s->s.help_color,
+ _(help_patch_text));
}
/* Any hunk to be used? */