From 609a8ee8c793856b8c1e6b7c553ee3475ca8308f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 18 Aug 2017 08:49:37 +0700 Subject: [PATCH] Change selection extension code to be simpler Selection extension now just keeps the anchor in place insead of trying to be smart depending on the direction of selections. --- src/selection.cc | 4 ---- test/normal/find-char-backward-extending/selections | 2 +- test/normal/object/start-extending/braces/selections | 2 +- test/normal/object/start-extending/brackets/selections | 2 +- test/normal/object/start-extending/sentence/selections | 2 +- test/normal/to-char-backward-extending/selections | 2 +- 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/selection.cc b/src/selection.cc index a2c53b59..43f47090 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -10,10 +10,6 @@ namespace Kakoune void Selection::merge_with(const Selection& other) { m_cursor = other.m_cursor; - if (m_anchor < m_cursor) - m_anchor = std::min(m_anchor, other.m_anchor); - if (m_anchor > m_cursor) - m_anchor = std::max(m_anchor, other.m_anchor); } SelectionList::SelectionList(Buffer& buffer, Selection s, size_t timestamp) diff --git a/test/normal/find-char-backward-extending/selections b/test/normal/find-char-backward-extending/selections index cecd2dec..8e85b581 100644 --- a/test/normal/find-char-backward-extending/selections +++ b/test/normal/find-char-backward-extending/selections @@ -1 +1 @@ -|bar +|b diff --git a/test/normal/object/start-extending/braces/selections b/test/normal/object/start-extending/braces/selections index 6e365bec..5a948a11 100644 --- a/test/normal/object/start-extending/braces/selections +++ b/test/normal/object/start-extending/braces/selections @@ -1,2 +1,2 @@ { - "foo + "f diff --git a/test/normal/object/start-extending/brackets/selections b/test/normal/object/start-extending/brackets/selections index a42eb4eb..126b0c8b 100644 --- a/test/normal/object/start-extending/brackets/selections +++ b/test/normal/object/start-extending/brackets/selections @@ -1,2 +1,2 @@ [ - "foo + "f diff --git a/test/normal/object/start-extending/sentence/selections b/test/normal/object/start-extending/sentence/selections index 837b6bb4..27e4da30 100644 --- a/test/normal/object/start-extending/sentence/selections +++ b/test/normal/object/start-extending/sentence/selections @@ -1,2 +1,2 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor -incididunt ut labore et dolore magna aliqua +incididunt ut labore et d diff --git a/test/normal/to-char-backward-extending/selections b/test/normal/to-char-backward-extending/selections index cecd2dec..8e85b581 100644 --- a/test/normal/to-char-backward-extending/selections +++ b/test/normal/to-char-backward-extending/selections @@ -1 +1 @@ -|bar +|b