git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] make --color-words separate word on ispunct

From
Ssgala@hisitech.com <sgala@hisitech.com>
Date
Apr 12, 2008, 10:33 UTC
Message-ID
<1207996421-29651-1-git-send-email-sgala@apache.org>

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
Next: Johannes Schindelin
Message 1 of 4 in “make --color-words separate word on ispunct”
  1. make --color-words separate word on ispunctsgala@hisitech.com, Apr 12, 2008
  2. Johannes SchindelinApr 12, 2008
  3. Ping YinApr 12, 2008
  4. Santiago GalaApr 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.