diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-01-23 19:48:43 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-01-23 20:14:08 +1100 |
| commit | 370d10ccc7b19fee5d10332a7c6b934376ed2df7 (patch) | |
| tree | 64717f3901ac8b54efabf539294bceebad286e88 /src/selection.cc | |
| parent | c07f052de7fe98d4d991eaa207a34982cd2fc0c0 (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.cc | 8 |
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); |
