summaryrefslogtreecommitdiff
path: root/src/selection.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-01-23 19:48:43 +1100
committerMaxime Coste <mawww@kakoune.org>2019-01-23 20:14:08 +1100
commit370d10ccc7b19fee5d10332a7c6b934376ed2df7 (patch)
tree64717f3901ac8b54efabf539294bceebad286e88 /src/selection.cc
parentc07f052de7fe98d4d991eaa207a34982cd2fc0c0 (diff)
Always select inserted text after piping
Relying on general selection update code is error prone due to diffing. Fixes #2394
Diffstat (limited to 'src/selection.cc')
-rw-r--r--src/selection.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/selection.cc b/src/selection.cc
index c245095d..5e3ff2e7 100644
--- a/src/selection.cc
+++ b/src/selection.cc
@@ -409,8 +409,12 @@ void SelectionList::insert(ConstArrayView<String> strings, InsertMode mode,
const String& str = strings[std::min(index, strings.size()-1)];
const auto pos = (mode == InsertMode::Replace) ?
- replace(*m_buffer, sel, str)
- : m_buffer->insert(changes_tracker.get_new_coord(insert_pos[index]), str);
+ sel.min() : changes_tracker.get_new_coord(insert_pos[index]);
+
+ if (mode == InsertMode::Replace)
+ replace(*m_buffer, sel, str);
+ else
+ m_buffer->insert(pos, str);
size_t old_timestamp = m_timestamp;
changes_tracker.update(*m_buffer, m_timestamp);