mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
Remove dead code
This commit is contained in:
parent
4698356f8b
commit
fc2ef0991e
4 changed files with 6 additions and 63 deletions
|
@ -99,7 +99,7 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
|
||||||
|
|
||||||
fn semantic_selection(&mut self, point: Point) {
|
fn semantic_selection(&mut self, point: Point) {
|
||||||
let point = self.terminal.visible_to_buffer(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;
|
self.terminal.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,6 @@ impl<T: Copy + Clone> Grid<T> {
|
||||||
new_line_count: index::Line,
|
new_line_count: index::Line,
|
||||||
template: &T,
|
template: &T,
|
||||||
) {
|
) {
|
||||||
let previous_scroll_limit = self.scroll_limit;
|
|
||||||
let lines_added = new_line_count - self.lines;
|
let lines_added = new_line_count - self.lines;
|
||||||
|
|
||||||
// Need to "resize" before updating buffer
|
// Need to "resize" before updating buffer
|
||||||
|
|
|
@ -172,25 +172,11 @@ impl<T> Storage<T> {
|
||||||
self.len
|
self.len
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn raw_len(&self) -> usize {
|
|
||||||
self.inner.len()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compute actual index in underlying storage given the requested index.
|
/// Compute actual index in underlying storage given the requested index.
|
||||||
fn compute_index(&self, requested: usize) -> usize {
|
fn compute_index(&self, requested: usize) -> usize {
|
||||||
(requested + self.zero) % self.inner.len()
|
(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) {
|
pub fn swap_lines(&mut self, a: Line, b: Line) {
|
||||||
let offset = self.inner.len() + self.zero + *self.visible_lines;
|
let offset = self.inner.len() + self.zero + *self.visible_lines;
|
||||||
let a = (offset - *a) % self.inner.len();
|
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
|
/// Iterate over *all* entries in the underlying buffer
|
||||||
///
|
///
|
||||||
/// This includes hidden entries.
|
/// 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)]
|
#[cfg(test)]
|
||||||
use index::Column;
|
use index::Column;
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,6 @@ pub enum Selection {
|
||||||
Semantic {
|
Semantic {
|
||||||
/// The region representing start and end of cursor movement
|
/// The region representing start and end of cursor movement
|
||||||
region: Range<Point<usize>>,
|
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 {
|
Lines {
|
||||||
/// The region representing start and end of cursor movement
|
/// 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.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;
|
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.start.line = (region.start.line as isize + offset) as usize;
|
||||||
region.end.line = (region.end.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 } => {
|
Selection::Lines { ref mut region, ref mut initial_line } => {
|
||||||
region.start.line = (region.start.line as isize + offset) as usize;
|
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 {
|
pub fn semantic(point: Point<usize>) -> Selection {
|
||||||
let (start, end) = (grid.semantic_search_left(point), grid.semantic_search_right(point));
|
|
||||||
Selection::Semantic {
|
Selection::Semantic {
|
||||||
region: Range {
|
region: Range {
|
||||||
start: point,
|
start: point,
|
||||||
end: point,
|
end: point,
|
||||||
},
|
|
||||||
initial_expansion: Range {
|
|
||||||
start: start,
|
|
||||||
end: end
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +141,7 @@ impl Selection {
|
||||||
Selection::Simple { ref mut region } => {
|
Selection::Simple { ref mut region } => {
|
||||||
region.end = Anchor::new(location, side);
|
region.end = Anchor::new(location, side);
|
||||||
},
|
},
|
||||||
Selection::Semantic { ref mut region, .. } |
|
Selection::Semantic { ref mut region } |
|
||||||
Selection::Lines { ref mut region, .. } =>
|
Selection::Lines { ref mut region, .. } =>
|
||||||
{
|
{
|
||||||
region.end = location;
|
region.end = location;
|
||||||
|
@ -166,8 +154,8 @@ impl Selection {
|
||||||
Selection::Simple { ref region } => {
|
Selection::Simple { ref region } => {
|
||||||
Selection::span_simple(grid, region)
|
Selection::span_simple(grid, region)
|
||||||
},
|
},
|
||||||
Selection::Semantic { ref region, ref initial_expansion } => {
|
Selection::Semantic { ref region } => {
|
||||||
Selection::span_semantic(grid, region, initial_expansion)
|
Selection::span_semantic(grid, region)
|
||||||
},
|
},
|
||||||
Selection::Lines { ref region, ref initial_line } => {
|
Selection::Lines { ref region, ref initial_line } => {
|
||||||
Selection::span_lines(grid, region, *initial_line)
|
Selection::span_lines(grid, region, *initial_line)
|
||||||
|
@ -177,7 +165,6 @@ impl Selection {
|
||||||
fn span_semantic<G>(
|
fn span_semantic<G>(
|
||||||
grid: &G,
|
grid: &G,
|
||||||
region: &Range<Point<usize>>,
|
region: &Range<Point<usize>>,
|
||||||
initial_expansion: &Range<Point<usize>>
|
|
||||||
) -> Option<Span>
|
) -> Option<Span>
|
||||||
where G: SemanticSearch + Dimensions
|
where G: SemanticSearch + Dimensions
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue