Git development
 help / color / mirror / Atom feed
* [PATCH] make --color-words separate word on ispunct
@ 2008-04-12 10:33 sgala
  2008-04-12 15:23 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: sgala @ 2008-04-12 10:33 UTC (permalink / raw)
  To: git; +Cc: Santiago Gala

Note that this may actually be harmful when trying to spot punctuation
changes, but for this use case I don't think color-words is helping
now either.

Signed-off-by: Santiago Gala <sgala@apache.org>
---
 diff.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/diff.c b/diff.c
index 8022e67..d301fcc 100644
--- a/diff.c
+++ b/diff.c
@@ -448,7 +448,7 @@ static void diff_words_show(struct diff_words_data *diff_words)
 	minus.ptr = xmalloc(minus.size);
 	memcpy(minus.ptr, diff_words->minus.text.ptr, minus.size);
 	for (i = 0; i < minus.size; i++)
-		if (isspace(minus.ptr[i]))
+		if (isspace(minus.ptr[i]) || ispunct(minus.ptr[i]))
 			minus.ptr[i] = '\n';
 	diff_words->minus.current = 0;
 
@@ -456,7 +456,7 @@ static void diff_words_show(struct diff_words_data *diff_words)
 	plus.ptr = xmalloc(plus.size);
 	memcpy(plus.ptr, diff_words->plus.text.ptr, plus.size);
 	for (i = 0; i < plus.size; i++)
-		if (isspace(plus.ptr[i]))
+		if (isspace(plus.ptr[i]) || ispunct(plus.ptr[i]))
 			plus.ptr[i] = '\n';
 	diff_words->plus.current = 0;
 
-- 
1.5.5.44.gdfa65.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-12 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-12 10:33 [PATCH] make --color-words separate word on ispunct sgala
2008-04-12 15:23 ` Johannes Schindelin
2008-04-12 15:32   ` Ping Yin
2008-04-12 17:50     ` Santiago Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox