Fix keyword highlighting off-by-one errors, to fix keyword highlighting
This commit is contained in:
parent
cec958932c
commit
d45911767d
@ -575,7 +575,7 @@ impl Editor {
|
||||
|
||||
let search_range = get_slice_range(i, keyword.len(), render_len);
|
||||
|
||||
let next_char_offset = i + keyword.len() + 1;
|
||||
let next_char_offset = i + keyword.len();
|
||||
let is_end_of_line = next_char_offset >= render_len;
|
||||
let next_char = if is_end_of_line {
|
||||
'\0'
|
||||
@ -585,7 +585,7 @@ impl Editor {
|
||||
|
||||
if &row.render[search_range.clone()] == keyword && is_separator(next_char) {
|
||||
highlight_range(&mut row.highlight, search_range, Highlight::Keyword1);
|
||||
i += keyword.len();
|
||||
i += keyword.len() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -596,7 +596,7 @@ impl Editor {
|
||||
|
||||
let search_range = get_slice_range(i, keyword.len(), render_len);
|
||||
|
||||
let next_char_offset = i + keyword.len() + 1;
|
||||
let next_char_offset = i + keyword.len();
|
||||
let is_end_of_line = next_char_offset >= render_len;
|
||||
let next_char = if is_end_of_line {
|
||||
'\0'
|
||||
@ -606,7 +606,7 @@ impl Editor {
|
||||
|
||||
if &row.render[search_range.clone()] == keyword && is_separator(next_char) {
|
||||
highlight_range(&mut row.highlight, search_range, Highlight::Keyword2);
|
||||
i += keyword.len();
|
||||
i += keyword.len() - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user