mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 14:22:37 +03:00
termwiz: fix off-by-one in computing line length
We were over-allocating 1 extra cell in the end-of-line case
This commit is contained in:
parent
1e7c7e7059
commit
60786dd74d
@ -438,17 +438,17 @@ impl Line {
|
||||
}
|
||||
|
||||
fn set_cell_impl(&mut self, idx: usize, cell: Cell, clear: bool, seqno: SequenceNo) -> &Cell {
|
||||
let width = cell.width();
|
||||
|
||||
// if the line isn't wide enough, pad it out with the default attributes.
|
||||
// The .max(1) stuff is here in case we get called with a
|
||||
// zero-width cell. That shouldn't happen: those sequences
|
||||
// should get filtered out in the terminal parsing layer,
|
||||
// but in case one does sneak through, we need to ensure that
|
||||
// we grow the cells array to hold this bogus entry.
|
||||
// https://github.com/wez/wezterm/issues/768
|
||||
if idx + width.max(1) >= self.cells.len() {
|
||||
self.cells.resize(idx + width.max(1), Cell::default());
|
||||
let width = cell.width().max(1);
|
||||
|
||||
// if the line isn't wide enough, pad it out with the default attributes.
|
||||
if idx + width > self.cells.len() {
|
||||
self.cells.resize(idx + width, Cell::default());
|
||||
}
|
||||
|
||||
self.invalidate_implicit_hyperlinks(seqno);
|
||||
|
Loading…
Reference in New Issue
Block a user