From 4906609dd9ee2c6fa6be1402f077d238925f6a46 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 4 Aug 2012 18:02:13 -0700 Subject: [PATCH] Fix for assertion failure in syntax highlighting --- highlight.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/highlight.cpp b/highlight.cpp index d8b7e7ea4..e0c99778d 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -356,7 +356,7 @@ rgb_color_t highlight_get_color( int highlight, bool is_background ) /** Highlight operators (such as $, ~, %, as well as escaped characters. */ -static void highlight_param( const wcstring &buffstr, std::vector &colors, size_t pos, wcstring_list_t *error ) +static void highlight_param( const wcstring &buffstr, std::vector &colors, wcstring_list_t *error ) { const wchar_t * const buff = buffstr.c_str(); enum {e_unquoted, e_single_quoted, e_double_quoted} mode = e_unquoted; @@ -970,8 +970,7 @@ static void tokenize( const wchar_t * const buff, std::vector &color, const std::vector::const_iterator where = color.begin() + tok_pos; std::vector subcolors(where, where + param_str.size()); subcolors.push_back(-1); - assert(pos >= tok_pos); - highlight_param(param_str, subcolors, pos-tok_pos, error); + highlight_param(param_str, subcolors, error); /* Copy the subcolors back into our colors array */ std::copy(subcolors.begin(), subcolors.begin() + param_str.size(), color.begin() + tok_pos);