mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
Remove some unused methods and impls
This commit is contained in:
parent
1d7ba0588e
commit
9fdf77f91a
4 changed files with 23 additions and 46 deletions
|
@ -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,19 +131,7 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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[..]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue