color_string_internal to use a sentinel value that's definitely invalid

I think -1 is slightly more elegant than 0 because 0 could be a valid offset.

No functional change.
This commit is contained in:
Johannes Altmanninger 2022-10-05 22:24:37 -05:00
parent 5868b3c380
commit f82537bcdc

View file

@ -552,7 +552,7 @@ static void color_string_internal(const wcstring &buffstr, highlight_spec_t base
enum { e_unquoted, e_single_quoted, e_double_quoted } mode = e_unquoted;
// For some ungodly reason making this a maybe<size_t> makes gcc grumpy
size_t unclosed_quote_offset = 0;
auto unclosed_quote_offset = std::numeric_limits<size_t>::max();
int bracket_count = 0;
for (size_t in_pos = 0; in_pos < buff_len; in_pos++) {
const wchar_t c = buffstr.at(in_pos);