summaryrefslogtreecommitdiff
path: root/src/selection.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-01-03 18:41:45 +0000
committerMaxime Coste <mawww@kakoune.org>2017-01-03 18:41:45 +0000
commit4295736c972ffda876b499d09c5815a6a38cef91 (patch)
tree405f9aef568b37830975a2f311df07c46c6ef037 /src/selection.hh
parent5763cbb9274a7bce12d192658f2e00da26af6688 (diff)
Fix handling of main selection when copying selection to next/previous lines
Fixes #1095
Diffstat (limited to 'src/selection.hh')
-rw-r--r--src/selection.hh10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/selection.hh b/src/selection.hh
index 92eecea6..edf8e601 100644
--- a/src/selection.hh
+++ b/src/selection.hh
@@ -101,12 +101,18 @@ struct SelectionList
SelectionList& operator=(Vector<Selection> list)
{
+ set(std::move(list), list.size()-1);
+ return *this;
+ }
+
+ void set(Vector<Selection> list, size_t main)
+ {
+ kak_assert(main < list.size());
m_selections = std::move(list);
- m_main = size()-1;
+ m_main = main;
sort_and_merge_overlapping();
update_timestamp();
check_invariant();
- return *this;
}
using iterator = Vector<Selection>::iterator;