diff options
author | Mathis Brossier | 2022-01-16 01:55:28 +0000 |
---|---|---|
committer | GitHub | 2022-01-16 01:55:28 +0000 |
commit | f5b0821860940782567a0baa17280aef04f845e3 (patch) | |
tree | 40b72ef97945fb535fd7e3f29898c1b59a1e4a07 /helix-tui/src/backend/test.rs | |
parent | 9da0abaa5d0744d6480c6e6f23a3c5ddb5ae0bce (diff) |
Fix panics when resizing (#1408)
* Change buffer.get & buffer.get_mut to return Option, Implement Trait Index & IndexMut to panic
* Prevent FilePicker from drawing outside buffer (rust panics)
* apply suggestion
* add function in_bounds to avoid useless calculations
Co-authored-by: mathis <mathis.brossier@universite-paris-saclay.fr>
Diffstat (limited to 'helix-tui/src/backend/test.rs')
-rw-r--r-- | helix-tui/src/backend/test.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/helix-tui/src/backend/test.rs b/helix-tui/src/backend/test.rs index 3f56b49c..52474148 100644 --- a/helix-tui/src/backend/test.rs +++ b/helix-tui/src/backend/test.rs @@ -111,8 +111,7 @@ impl Backend for TestBackend { I: Iterator<Item = (u16, u16, &'a Cell)>, { for (x, y, c) in content { - let cell = self.buffer.get_mut(x, y); - *cell = c.clone(); + self.buffer[(x, y)] = c.clone(); } Ok(()) } |