From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: [PATCH] diff-highlight: Fix broken multibyte string Date: Sat, 4 Apr 2015 10:10:26 -0400 Message-ID: <20150404141026.GB25455@peff.net> References: <1427730933-26189-1-git-send-email-eungjun.yi@navercorp.com> <20150330221635.GB25212@peff.net> <20150403012430.GA16173@peff.net> <20150403220821.GB11220@peff.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: "Yi, EungJun" , Git List To: "Kyle J. McKay" X-From: git-owner@vger.kernel.org Sat Apr 04 16:10:35 2015 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YeOmP-00088k-LY for gcvg-git-2@plane.gmane.org; Sat, 04 Apr 2015 16:10:34 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752698AbbDDOK3 (ORCPT ); Sat, 4 Apr 2015 10:10:29 -0400 Received: from cloud.peff.net ([50.56.180.127]:42415 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752595AbbDDOK2 (ORCPT ); Sat, 4 Apr 2015 10:10:28 -0400 Received: (qmail 22860 invoked by uid 102); 4 Apr 2015 14:10:28 -0000 Received: from Unknown (HELO peff.net) (10.0.1.1) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Sat, 04 Apr 2015 09:10:28 -0500 Received: (qmail 30683 invoked by uid 107); 4 Apr 2015 14:10:47 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Sat, 04 Apr 2015 10:10:47 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Sat, 04 Apr 2015 10:10:26 -0400 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Fri, Apr 03, 2015 at 03:24:09PM -0700, Kyle J. McKay wrote: > >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