Correctly highlight =s in var assignments after the first

We were not correctly offsetting the = in the token, it was always from the
start of the string.
This commit is contained in:
ridiculousfish
2020-08-11 12:27:32 -07:00
parent 703e6f571e
commit 65f7f90433
2 changed files with 8 additions and 1 deletions

View File

@@ -1034,8 +1034,10 @@ void highlighter_t::visit(const ast::argument_t &arg, bool cmd_is_cd) {
void highlighter_t::visit(const ast::variable_assignment_t &varas) {
color_as_argument(varas);
// Highlight the '=' in variable assignments as an operator.
if (auto where = variable_assignment_equals_pos(varas.source(this->buff))) {
this->color_array.at(*where) = highlight_role_t::operat;
size_t equals_loc = varas.source_range().start + *where;
this->color_array.at(equals_loc) = highlight_role_t::operat;
}
}