1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 06:54:45 +03:00

search: fix coordinates for matches at EOL

The returned coords didn't include the last cell on the line;
adjust the fallback case to generate an exclusive rather than
inclusive end coordinate.
This commit is contained in:
Wez Furlong 2022-07-24 16:56:19 -07:00
parent ec46aba089
commit 5831bd7c8d

View File

@ -628,7 +628,13 @@ impl Pane for LocalPane {
.binary_search_by(|ele| ele.byte_idx.cmp(&idx))
.or_else(|i| -> Result<usize, usize> { Ok(i) })
.unwrap();
let coord = coords.get(c).or_else(|| coords.last()).unwrap();
let coord = coords.get(c).map(|c| *c).unwrap_or_else(|| {
let last = coords.last().unwrap();
Coord {
grapheme_idx: last.grapheme_idx + 1,
..*last
}
});
(coord.grapheme_idx, coord.stable_row)
}