From ab536e5199e205db9be69866628a1a885cac1475 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 31 Mar 2012 14:05:14 -0700 Subject: Fix for incorrectly highlighted parameters --- highlight.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'highlight.cpp') diff --git a/highlight.cpp b/highlight.cpp index 3f4cde85..a1ac40b0 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -919,12 +919,14 @@ static void tokenize( const wchar_t * const buff, std::vector &color, const /* Highlight the parameter. highlight_param wants to write one more color than we have characters (hysterical raisins) so allocate one more in the vector. But don't copy it back. */ const wcstring param_str = param; - std::vector subcolors; - subcolors.resize(1 + param_str.size(), -1); int tok_pos = tok_get_pos(&tok); + + std::vector::const_iterator where = color.begin() + tok_pos; + std::vector subcolors(where, where + param_str.size()); + subcolors.push_back(-1); highlight_param(param_str, subcolors, pos-tok_pos, error); - /* Copy the subcolors into our colors array */ + /* Copy the subcolors back into our colors array */ std::copy(subcolors.begin(), subcolors.begin() + param_str.size(), color.begin() + tok_pos); } else -- cgit v1.2.3