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

Re: [PATCH] diff-highlight: Fix broken multibyte string

From
Jeff King <peff@peff.net>
Date
Apr 4, 2015, 14:10 UTC
Message-ID
<20150404141026.GB25455@peff.net>
In-Reply-To
<CDAB9DBC-0F59-4176-BD9F-620A124EA300@gmail.com>
On Fri, Apr 03, 2015 at 03:24:09PM -0700, Kyle J. McKay wrote:
Show 10 quoted lines
> >I thought that meant we could also optimize out the "map" call entirely,
> >and just use the first split (with "*") to end up with a list of $COLOR
> >chunks and single characters, but it does not seem to work. So maybe I
> >am misreading something about what is going on.
> 
> I think our emails crossed in flight...
> 
> Using just the first split (with "*") produces useless empty elements which
> I think ends up causing problems.  I suppose you could surround it with a
> grep /./ to remove them but that would defeat the point of the optimization.

Yeah, the problem is the use of (). We want to keep the $COLOR delimiters, but not the empty ones. Perhaps you could do:

  split /($COLOR+)|/

but I didn't try it. I think what you posted is good and a lot less subtle.

-Peff
Previous: Kyle J. McKayNext: Kyle J. McKay
Message 10 of 13 in “diff-highlight: Fix broken multibyte string”
  1. diff-highlight: Fix broken multibyte stringYi EungJun, Mar 30, 2015
  2. Jeff KingMar 30, 2015
  3. Kyle J. McKayApr 3, 2015
  4. Jeff KingApr 3, 2015
  5. Kyle J. McKayApr 3, 2015
  6. Jeff KingApr 3, 2015
  7. Yi, EungJunApr 3, 2015
  8. Jeff KingApr 3, 2015
  9. Kyle J. McKayApr 3, 2015
  10. Jeff KingApr 4, 2015
  11. diff-highlight: do not split multibyte charactersKyle J. McKay, Apr 3, 2015
  12. Jeff KingApr 4, 2015
  13. Yi, EungJunApr 4, 2015

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.