1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Remove dead code

This commit is contained in:
Joe Wilm 2018-05-29 21:45:28 -07:00
parent a2f9988377
commit 24c50fa0a7
4 changed files with 6 additions and 63 deletions

View file

@ -99,7 +99,7 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
fn semantic_selection(&mut self, point: Point) {
let point = self.terminal.visible_to_buffer(point);
*self.terminal.selection_mut() = Some(Selection::semantic(point, &*self.terminal));
*self.terminal.selection_mut() = Some(Selection::semantic(point));
self.terminal.dirty = true;
}

View file

@ -230,7 +230,6 @@ impl<T: Copy + Clone> Grid<T> {
new_line_count: index::Line,
template: &T,
) {
let previous_scroll_limit = self.scroll_limit;
let lines_added = new_line_count - self.lines;
// Need to "resize" before updating buffer

View file

@ -172,25 +172,11 @@ impl<T> Storage<T> {
self.len
}
#[inline]
pub fn raw_len(&self) -> usize {
self.inner.len()
}
/// Compute actual index in underlying storage given the requested index.
fn compute_index(&self, requested: usize) -> usize {
(requested + self.zero) % self.inner.len()
}
#[inline]
pub fn line_offset(&self) -> usize {
self.inner.len() + self.zero + *self.visible_lines
}
pub fn compute_line_index(&self, a: Line) -> usize {
(self.line_offset() - *a) % self.inner.len()
}
pub fn swap_lines(&mut self, a: Line, b: Line) {
let offset = self.inner.len() + self.zero + *self.visible_lines;
let a = (offset - *a) % self.inner.len();
@ -234,13 +220,6 @@ impl<T> Storage<T> {
}
}
/// Iterator over *logical* entries in the storage
///
/// This *does not* iterate over hidden entries.
pub fn iter_mut(&mut self) -> IterMut<T> {
IterMut { storage: self, index: 0 }
}
/// Iterate over *all* entries in the underlying buffer
///
/// This includes hidden entries.
@ -300,28 +279,6 @@ impl<T> IndexMut<Line> for Storage<T> {
}
}
pub struct IterMut<'a, T: 'a> {
storage: &'a mut Storage<T>,
index: usize,
}
impl<'a, T: 'a> Iterator for IterMut<'a, T> {
type Item = &'a mut Row<T>;
fn next(&mut self) -> Option<Self::Item> {
if self.index == self.storage.len() {
None
} else {
let index = self.index;
self.index += 1;
unsafe {
Some(&mut *(&mut self.storage[index] as *mut _))
}
}
}
}
#[cfg(test)]
use index::Column;

View file

@ -47,11 +47,6 @@ pub enum Selection {
Semantic {
/// The region representing start and end of cursor movement
region: Range<Point<usize>>,
/// When beginning a semantic selection, the grid is searched around the
/// initial point to find semantic escapes, and this initial expansion
/// marks those points.
initial_expansion: Range<Point<usize>>
},
Lines {
/// The region representing start and end of cursor movement
@ -109,11 +104,9 @@ impl Selection {
region.start.point.line = (region.start.point.line as isize + offset) as usize;
region.end.point.line = (region.end.point.line as isize + offset) as usize;
},
Selection::Semantic { ref mut region, ref mut initial_expansion } => {
Selection::Semantic { ref mut region } => {
region.start.line = (region.start.line as isize + offset) as usize;
region.end.line = (region.end.line as isize + offset) as usize;
initial_expansion.start.line = (initial_expansion.start.line as isize + offset) as usize;
initial_expansion.end.line = (initial_expansion.end.line as isize + offset) as usize;
},
Selection::Lines { ref mut region, ref mut initial_line } => {
region.start.line = (region.start.line as isize + offset) as usize;
@ -123,16 +116,11 @@ impl Selection {
}
}
pub fn semantic<G: SemanticSearch>(point: Point<usize>, grid: &G) -> Selection {
let (start, end) = (grid.semantic_search_left(point), grid.semantic_search_right(point));
pub fn semantic(point: Point<usize>) -> Selection {
Selection::Semantic {
region: Range {
start: point,
end: point,
},
initial_expansion: Range {
start: start,
end: end
}
}
}
@ -153,7 +141,7 @@ impl Selection {
Selection::Simple { ref mut region } => {
region.end = Anchor::new(location, side);
},
Selection::Semantic { ref mut region, .. } |
Selection::Semantic { ref mut region } |
Selection::Lines { ref mut region, .. } =>
{
region.end = location;
@ -166,8 +154,8 @@ impl Selection {
Selection::Simple { ref region } => {
Selection::span_simple(grid, region)
},
Selection::Semantic { ref region, ref initial_expansion } => {
Selection::span_semantic(grid, region, initial_expansion)
Selection::Semantic { ref region } => {
Selection::span_semantic(grid, region)
},
Selection::Lines { ref region, ref initial_line } => {
Selection::span_lines(grid, region, *initial_line)
@ -177,7 +165,6 @@ impl Selection {
fn span_semantic<G>(
grid: &G,
region: &Range<Point<usize>>,
initial_expansion: &Range<Point<usize>>
) -> Option<Span>
where G: SemanticSearch + Dimensions
{