From fcea723aa70e4dce3cb75c1642d1adb90cbefd4f Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 13 Feb 2012 17:15:41 -0800 Subject: [PATCH] Fixed parenthesis causing a crash or bizarre layout. --- highlight.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/highlight.cpp b/highlight.cpp index 655d083d3..2d4474782 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -921,7 +921,8 @@ void highlight_shell( const wchar_t * const buff, int *color, int pos, wcstring_ Locate and syntax highlight cmdsubsts recursively */ - const wchar_t * subpos=buff; + wchar_t * const subbuff = wcsdup(buff); + wchar_t * subpos = subbuff; int done=0; while( 1 ) @@ -938,15 +939,15 @@ void highlight_shell( const wchar_t * const buff, int *color, int pos, wcstring_ else *end=0; - highlight_shell( begin+1, color +(begin-buff)+1, -1, error, vars ); - color[end-buff]=HIGHLIGHT_OPERATOR; + highlight_shell( begin+1, color + (begin-subbuff)+1, -1, error, vars ); + color[end-subbuff]=HIGHLIGHT_OPERATOR; if( done ) break; subpos = end+1; - } + free(subbuff); /* The highlighting code only changes the first element when the