diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-13 17:15:41 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-13 17:15:41 -0800 |
commit | fcea723aa70e4dce3cb75c1642d1adb90cbefd4f (patch) | |
tree | 450021d0fc12d13ca52583be0b60116ef058aa56 /highlight.cpp | |
parent | faf80588abfd53c4021c099010ac1b21efb1cbcc (diff) |
Fixed parenthesis causing a crash or bizarre layout.
Diffstat (limited to 'highlight.cpp')
-rw-r--r-- | highlight.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/highlight.cpp b/highlight.cpp index 655d083d..2d447478 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 |