aboutsummaryrefslogtreecommitdiff
path: root/src/selection.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-04-28 16:15:21 +0200
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commit8168d85a21b1a67b9cf25808c4e3e01f7437b50d (patch)
treedd223830f36ad99b2f48ebb7872ac5be67bba10f /src/selection.rs
parent31c0f291e0f1b8489366e011a5206e981a68beb2 (diff)
downloadalacritty-8168d85a21b1a67b9cf25808c4e3e01f7437b50d.tar.gz
alacritty-8168d85a21b1a67b9cf25808c4e3e01f7437b50d.zip
Improve storage comparison algorithm
Instead of iterating over the raw storage vector because the offsets don't allow direct comparison, the comparison is now done in chunks. Based on benchmarking this is a lot more efficient than using split_off + append or iterating over the elements of the buffer. The `history_size` field has also been removed from the storage structure because it can be easily calculated by substracting the number of visible lines from the length of the raw storage vector.
Diffstat (limited to 'src/selection.rs')
-rw-r--r--src/selection.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/selection.rs b/src/selection.rs
index 6f910bce..a54bd49d 100644
--- a/src/selection.rs
+++ b/src/selection.rs
@@ -38,7 +38,7 @@ use index::{Point, Column, Side};
/// [`simple`]: enum.Selection.html#method.simple
/// [`semantic`]: enum.Selection.html#method.semantic
/// [`lines`]: enum.Selection.html#method.lines
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
pub enum Selection {
Simple {
/// The region representing start and end of cursor movement
@@ -64,7 +64,7 @@ pub enum Selection {
}
/// A Point and side within that point.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
pub struct Anchor {
point: Point<usize>,
side: Side,