mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 04:58:24 +08: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:
parent
0b6eab4ec3
commit
f6db6c41e6
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user