diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-05-29 23:12:04 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-05-29 23:12:04 +1000 |
| commit | 1ebea85e6f07aeb6a8287b8043480f56f0e58edb (patch) | |
| tree | c67f3e546db9a8582b524839f7f7e89c0e60c4d7 /src/selection.cc | |
| parent | 7efdbb456d6855fe72790050d067c8a1b66993ba (diff) | |
Do not merge selections on backspace in insert mode
Fixes #2861
Diffstat (limited to 'src/selection.cc')
| -rw-r--r-- | src/selection.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/selection.cc b/src/selection.cc index 30ff599b..9e300af6 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -218,7 +218,7 @@ void clamp_selections(Vector<Selection>& selections, const Buffer& buffer) clamp(sel, buffer); } -void update_selections(Vector<Selection>& selections, size_t& main, Buffer& buffer, size_t timestamp) +void update_selections(Vector<Selection>& selections, size_t& main, Buffer& buffer, size_t timestamp, bool merge) { if (timestamp == buffer.timestamp()) return; @@ -242,20 +242,22 @@ void update_selections(Vector<Selection>& selections, size_t& main, Buffer& buff } kak_assert(std::is_sorted(selections.begin(), selections.end(), compare_selections)); - selections.erase( - merge_overlapping(selections.begin(), selections.end(), - main, overlaps), selections.end()); + if (merge) + selections.erase( + merge_overlapping(selections.begin(), selections.end(), + main, overlaps), selections.end()); } for (auto& sel : selections) clamp(sel, buffer); - selections.erase(merge_overlapping(selections.begin(), selections.end(), - main, overlaps), selections.end()); + if (merge) + selections.erase(merge_overlapping(selections.begin(), selections.end(), + main, overlaps), selections.end()); } -void SelectionList::update() +void SelectionList::update(bool merge) { - update_selections(m_selections, m_main, *m_buffer, m_timestamp); + update_selections(m_selections, m_main, *m_buffer, m_timestamp, merge); check_invariant(); m_timestamp = m_buffer->timestamp(); } |
