From: Dan Holmsand <holmsand@gmail.com>
To: git@vger.kernel.org
Cc: Petr Baudis <pasky@ucw.cz>
Subject: [PATCH 2/6] Factor out color settings to cg-Xlib
Date: Thu, 09 Jun 2005 13:17:00 +0200 [thread overview]
Message-ID: <42A8252C.8040805@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
[PATCH 2/6] Factor out color settings to cg-Xlib
setup_colors sets color variables from COGITO_COLORS, and
adds a sed script for diff colorization to color_rules.
Note that this changes the default colors a little from the
ones in cg-diff: in particular there's no bold any more. Bold
isn't really necessary if the "less search" thing in the new
cg-diff/cg-log is used (and bold is really ugly in
gnome-terminal :-) ).
Signed-off-by: Dan Holmsand <holmsand@gmail.com>
---
[-- Attachment #2: 2-setupcolors.patch.txt --]
[-- Type: text/plain, Size: 1052 bytes --]
cg-Xlib | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -136,6 +136,29 @@ print_help () {
exit
}
+setup_colors() {
+ local C="header=32:author=36:signoff=33:committer=35:files=34"
+ C="$C:commit=34:date=32:trim=35"
+ C="$C:diffhdr=34:diffhdradd=32:diffadd=32:diffhdrmod=35"
+ C="$C:diffmod=35:diffhdrrem=31:diffrem=31:diffhunk=36"
+ C="$C:diffctx=34:diffcctx=33:default=0"
+ [ -n "$COGITO_COLORS" ] && C="$C:$COGITO_COLORS"
+
+ C=${C//=/=\'$'\e'[}
+ C=col${C//:/m\'; col}m\'
+ #coldefault=$(tput op)
+ eval $C
+
+ color_rules="
+s,^+++.*,$coldiffhdradd&$coldefault,
+s,^---.*,$coldiffhdrrem&$coldefault,
+s,^[+].*,$coldiffadd&$coldefault,
+s,^[-].*,$coldiffrem&$coldefault,
+s,^\\(@@.*@@\\)\\(.*\\),$coldiffhunk\\1$coldiffctx\\2$coldefault,
+s,^=*$',$coldiffhdr&$coldefault,
+s,^\\(Index:\\|===\\|diff\\) .*,$coldiffhdr&$coldefault,"
+}
+
for option in "$@"; do
if [ "$option" = "-h" -o "$option" = "--help" ]; then
print_help ${_cg_cmd##cg-}
reply other threads:[~2005-06-09 12:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=42A8252C.8040805@gmail.com \
--to=holmsand@gmail.com \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).