From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Michael J Gruber <git@drmicha.warpmail.net>, git@vger.kernel.org
Subject: [PATCH] Add a notice that only certain functions can print color escape codes
Date: Fri, 27 Nov 2009 08:00:01 +0100 [thread overview]
Message-ID: <4B0F78F1.4040101@viscovery.net> (raw)
In-Reply-To: <7vy6lt6rh3.fsf@alter.siamese.dyndns.org>
From: Johannes Sixt <j6t@kdbg.org>
We emulate color escape codes on Windows by overriding printf, fprintf,
and fputs. Warn users that these are the only functions that can be used
to print them.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Junio C Hamano schrieb:
> Johannes Sixt <j.sixt@viscovery.net> writes:
>
>> Michael J Gruber schrieb:
>>> * Is there any policy regarding use of putchar/puts vs. printf?
>> If the printed string contains color escapes that should be obeyed, you
>> can use only fputs, printf, and fprintf. You should not use puts or putchar.
>
> This msysgit-imposed restriction is something even I do not remember
> offhand. Could you please document it somewhere in a file any developer
> would get by checking out the 'master' branch of git.git?
Like this?
color.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/color.h b/color.h
index 7d8da6f..edeaa3e 100644
--- a/color.h
+++ b/color.h
@@ -4,6 +4,11 @@
/* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
#define COLOR_MAXLEN 24
+/*
+ * IMPORTANT: Due to the way these color codes are emulated on Windows,
+ * write them only using printf, fprintf, and fputs. In particular,
+ * do not use puts.
+ */
#define GIT_COLOR_NORMAL ""
#define GIT_COLOR_RESET "\033[m"
#define GIT_COLOR_BOLD "\033[1m"
--
1.6.6.rc0.43.g50037
next prev parent reply other threads:[~2009-11-27 7:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-26 15:24 [RFC/PATCH 0/2] status -s: Use the same config as status Michael J Gruber
2009-11-26 15:24 ` [RFC/PATCH 1/2] status -s: respect the status.relativePaths option Michael J Gruber
2009-11-27 3:15 ` Junio C Hamano
2009-11-27 7:05 ` Jeff King
2009-11-26 15:24 ` [RFC/PATCH 2/2] status -s: obey color.status Michael J Gruber
2009-11-26 15:36 ` Johannes Sixt
2009-11-26 16:03 ` Michael J Gruber
2009-11-26 19:00 ` Junio C Hamano
2009-11-27 7:00 ` Johannes Sixt [this message]
2009-11-27 7:30 ` [PATCH] Add a notice that only certain functions can print color escape codes Junio C Hamano
2009-11-27 7:42 ` Johannes Sixt
2009-11-27 9:22 ` Michael J Gruber
2009-11-27 5:15 ` [RFC/PATCH 2/2] status -s: obey color.status Junio C Hamano
2009-11-27 9:17 ` Michael J Gruber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B0F78F1.4040101@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.