mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-25 18:31:20 -03:00
reader: clarify bounds check when probing for cached highlighting
When we insert characters that don't yet have highlighting, we use the highlighting to the left, unless there is nothing to our left. The logic to check if we are the leftmost character uses an overly loose comparison. Let's make it more specific. No functional change.
This commit is contained in:
@@ -211,7 +211,7 @@ void apply_edit(wcstring *target, std::vector<highlight_spec_t> *colors, const e
|
||||
// Now do the same to highlighting.
|
||||
auto it = colors->begin() + offset;
|
||||
colors->erase(it, it + edit.length);
|
||||
highlight_spec_t last_color = offset < 1 ? highlight_spec_t{} : colors->at(offset - 1);
|
||||
highlight_spec_t last_color = offset == 0 ? highlight_spec_t{} : colors->at(offset - 1);
|
||||
colors->insert(it, edit.replacement.size(), last_color);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user