aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-10-12 20:29:35 -0700
committerJoe Wilm <joe@jwilm.com>2018-03-07 09:45:25 -0800
commit536590dc47d8ff024c55f2feb51c314cb1f79ae9 (patch)
tree88808b450ef750a5afe9157bd6a7727080789aa2
parent971e4b2dc1f9c6a79256d747c30f9986076dd571 (diff)
downloadalacritty-536590dc47d8ff024c55f2feb51c314cb1f79ae9.tar.gz
alacritty-536590dc47d8ff024c55f2feb51c314cb1f79ae9.zip
Remove some unused methods and impls
-rw-r--r--src/grid/mod.rs16
-rw-r--r--src/grid/row.rs43
-rw-r--r--src/term/mod.rs7
-rw-r--r--tests/ref.rs3
4 files changed, 23 insertions, 46 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs
index bd994033..9ca0011a 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -122,7 +122,7 @@ impl<T: Clone> Grid<T> {
}
fn grow_cols(&mut self, cols: index::Column, template: &T) {
- for row in self.lines_mut() {
+ for row in self.raw.iter_mut() {
row.grow(cols, template);
}
@@ -131,20 +131,8 @@ impl<T: Clone> Grid<T> {
}
-
-
impl<T> Grid<T> {
#[inline]
- pub fn lines(&self) -> vec_deque::Iter<Row<T>> {
- self.raw.iter()
- }
-
- #[inline]
- pub fn lines_mut(&mut self) -> vec_deque::IterMut<Row<T>> {
- self.raw.iter_mut()
- }
-
- #[inline]
pub fn num_lines(&self) -> index::Line {
self.lines
}
@@ -216,7 +204,7 @@ impl<T> Grid<T> {
}
fn shrink_cols(&mut self, cols: index::Column) {
- for row in self.lines_mut() {
+ for row in self.raw.iter_mut() {
row.shrink(cols);
}
diff --git a/src/grid/row.rs b/src/grid/row.rs
index 8711d04f..4b355a56 100644
--- a/src/grid/row.rs
+++ b/src/grid/row.rs
@@ -108,33 +108,8 @@ impl<T> IndexMut<Column> for Row<T> {
}
}
-macro_rules! row_index_range {
- ($range:ty) => {
- impl<T> Index<$range> for Row<T> {
- type Output = [T];
-
- #[inline]
- fn index(&self, index: $range) -> &[T] {
- &self.0[index]
- }
- }
-
- impl<T> IndexMut<$range> for Row<T> {
- #[inline]
- fn index_mut(&mut self, index: $range) -> &mut [T] {
- &mut self.0[index]
- }
- }
- }
-}
-
-row_index_range!(Range<usize>);
-row_index_range!(RangeTo<usize>);
-row_index_range!(RangeFrom<usize>);
-row_index_range!(RangeFull);
-
// -----------------------------------------------------------------------------
-// Column ranges for Row
+// Index ranges of columns
// -----------------------------------------------------------------------------
impl<T> Index<Range<Column>> for Row<T> {
@@ -184,3 +159,19 @@ impl<T> IndexMut<RangeFrom<Column>> for Row<T> {
&mut self.0[(index.start.0)..]
}
}
+
+impl<T> Index<RangeFull> for Row<T> {
+ type Output = [T];
+
+ #[inline]
+ fn index(&self, _: RangeFull) -> &[T] {
+ &self.0[..]
+ }
+}
+
+impl<T> IndexMut<RangeFull> for Row<T> {
+ #[inline]
+ fn index_mut(&mut self, _: RangeFull) -> &mut [T] {
+ &mut self.0[..]
+ }
+}
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 2bf5f9c1..1cb37816 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -1297,11 +1297,8 @@ impl ansi::Handler for Term {
let mut template = self.cursor.template;
template.c = 'E';
- for row in &mut self.grid.lines_mut() {
- for cell in row {
- cell.reset(&template);
- }
- }
+ self.grid.region_mut(..)
+ .each(|c| c.reset(&template));
}
#[inline]
diff --git a/tests/ref.rs b/tests/ref.rs
index 2a093704..6836a9f5 100644
--- a/tests/ref.rs
+++ b/tests/ref.rs
@@ -6,6 +6,7 @@ use std::io::{self, Read};
use std::path::Path;
use alacritty::Grid;
+use alacritty::grid::IndexRegion;
use alacritty::Term;
use alacritty::ansi;
use alacritty::index::{Line, Column};
@@ -84,7 +85,7 @@ fn ref_test(dir: &Path) {
}
if grid != *terminal.grid() {
- for (i, row) in terminal.grid().lines().enumerate() {
+ for (i, row) in terminal.grid().region(..).into_iter().enumerate() {
for (j, cell) in row.iter().enumerate() {
let original_cell = &grid[Line(i)][Column(j)];
if *original_cell != *cell {