diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-07-21 17:17:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-21 17:17:41 +0000 |
commit | f50ca1a54c94fe324d22d985c1acae1ff7c16a80 (patch) | |
tree | 7fc2e79f7dccf512fe71f841ef5434e0b1d2b5d7 /src/grid/mod.rs | |
parent | b05ad74fe6d42ce0f913e02ef633ca119fc0b43e (diff) | |
download | alacritty-f50ca1a54c94fe324d22d985c1acae1ff7c16a80.tar.gz alacritty-f50ca1a54c94fe324d22d985c1acae1ff7c16a80.zip |
Scrollback cleanup
There were some unneeded codeblocks and TODO/XXX comments in the code
that have been removed. All issues marked with TODO/XXX have either been
already resolved or tracking issues exist.
Diffstat (limited to 'src/grid/mod.rs')
-rw-r--r-- | src/grid/mod.rs | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs index 949a5ed5..ef587ffd 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -102,6 +102,7 @@ pub struct GridIterator<'a, T: 'a> { pub cur: Point<usize>, } +#[derive(Copy, Clone)] pub enum Scroll { Lines(isize), PageUp, @@ -396,6 +397,7 @@ impl<T: Copy + Clone> Grid<T> { } } +#[cfg_attr(feature = "cargo-clippy", allow(len_without_is_empty))] impl<T> Grid<T> { #[inline] pub fn num_lines(&self) -> index::Line { @@ -437,15 +439,6 @@ impl<T> Grid<T> { pub fn contains(&self, point: &Point) -> bool { self.lines > point.line && self.cols > point.col } - - // /// Swap two lines in the grid - // /// - // /// This could have used slice::swap internally, but we are able to have - // /// better error messages by doing the bounds checking ourselves. - // #[inline] - // pub fn swap_lines(&mut self, src: index::Line, dst: index::Line) { - // self.raw.swap(*src, *dst); - // } } impl<'a, T> Iterator for GridIterator<'a, T> { @@ -566,10 +559,10 @@ impl<'a, T> RegionMut<'a, T> { pub trait IndexRegion<I, T> { /// Get an immutable region of Self - fn region<'a>(&'a self, _: I) -> Region<'a, T>; + fn region(&self, _: I) -> Region<T>; /// Get a mutable region of Self - fn region_mut<'a>(&'a mut self, _: I) -> RegionMut<'a, T>; + fn region_mut(&mut self, _: I) -> RegionMut<T>; } impl<T> IndexRegion<Range<Line>, T> for Grid<T> { @@ -772,13 +765,11 @@ impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> { // Update line/col to point to next item self.col += 1; - if self.col == self.grid.num_cols() { - if self.offset != self.limit { - self.offset -= 1; + if self.col == self.grid.num_cols() && self.offset != self.limit { + self.offset -= 1; - self.col = Column(0); - self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit)); - } + self.col = Column(0); + self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit)); } item |