aboutsummaryrefslogtreecommitdiffhomepage
path: root/highlight.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-08-20 22:28:42 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-08-20 22:28:42 -0700
commita24998abac2cd9e0e91e8fed23a32742a3c2bd10 (patch)
tree914536b37039d7a4f5771a570b5612f2ad61cf8c /highlight.cpp
parentcc49042294aceb3ab30396eb5731e4ac0cf601bc (diff)
Highlight "$foo[1]" properly
Preserve the highlighting applied to the slice brackets when coloring variables inside of double-quoted strings.
Diffstat (limited to 'highlight.cpp')
-rw-r--r--highlight.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/highlight.cpp b/highlight.cpp
index 8145e5f3..f560264c 100644
--- a/highlight.cpp
+++ b/highlight.cpp
@@ -861,7 +861,11 @@ static void color_argument_internal(const wcstring &buffstr, std::vector<highlig
*/
case e_double_quoted:
{
- colors[in_pos] = highlight_spec_quote;
+ // slices are colored in advance, past `in_pos`, and we don't want to overwrite that
+ if (colors[in_pos] == highlight_spec_param)
+ {
+ colors[in_pos] = highlight_spec_quote;
+ }
switch (c)
{
case L'"':