summaryrefslogtreecommitdiffstats
path: root/src/grid/storage.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-03-09 13:49:47 -0800
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commitb0f655ac85ab6d86e9e482cbb9035200c6f08d40 (patch)
tree7cc0ec0a6d7f855557886bf0ab36b6217421af66 /src/grid/storage.rs
parent688cabefc0bfc3224189c10235668eae5e5b0101 (diff)
Make tests compile again
Some tests are still not passing, though. A migration script was added to migrate serialized grids from pre-scrollback to the current format. The script is included with this commit for completeness, posterity, and as an example to be used in the future. A few tests in grid/tests.rs were removed due to becoming irrelevant.
Diffstat (limited to 'src/grid/storage.rs')
-rw-r--r--src/grid/storage.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/grid/storage.rs b/src/grid/storage.rs
index 1588b006..0f1ba9c5 100644
--- a/src/grid/storage.rs
+++ b/src/grid/storage.rs
@@ -13,15 +13,25 @@
/// done so manually.
use std::ops::{Index, IndexMut};
-use index::Line;
+use index::{IndexRange, Line};
-#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Storage<T> {
inner: Vec<T>,
zero: usize,
visible_lines: Line,
}
+impl<T: PartialEq> ::std::cmp::PartialEq for Storage<T> {
+ fn eq(&self, other: &Self) -> bool {
+ let mut equal = true;
+ for i in IndexRange(Line(0) .. self.visible_lines) {
+ equal = equal && (self[i] == other[i])
+ }
+ equal
+ }
+}
+
impl<T> Storage<T> {
#[inline]
pub fn with_capacity(cap: usize, lines: Line) -> Storage<T> {