diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-31 14:05:14 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-31 14:05:14 -0700 |
commit | ab536e5199e205db9be69866628a1a885cac1475 (patch) | |
tree | aeb55a40351c117748fccfb18f874e8fced3080c /highlight.cpp | |
parent | c10b3017d6479bbfeceb3a466b6b2c04aa24d9b8 (diff) |
Fix for incorrectly highlighted parameters
Diffstat (limited to 'highlight.cpp')
-rw-r--r-- | highlight.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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<int> &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<int> subcolors; - subcolors.resize(1 + param_str.size(), -1); int tok_pos = tok_get_pos(&tok); + + std::vector<int>::const_iterator where = color.begin() + tok_pos; + std::vector<int> 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 |