diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-01-01 17:31:47 +0000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-01-01 17:31:47 +0000 |
| commit | cdb2c766a5480cf2352e7db9b57cc9fcb9a81df2 (patch) | |
| tree | c8fc513f303ec14fd046bcd2cff7ff13ea6d424d /src/normal.cc | |
| parent | 69789d4793f91daab4f489147338ed593f34093d (diff) | |
Refactor SelectionList::insert a bit
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/normal.cc b/src/normal.cc index 1386567d..835a9d32 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -594,21 +594,22 @@ void paste_all(Context& context, NormalParams params) offsets.push_back(all.length()); } + Vector<BufferCoord> insert_pos; auto& selections = context.selections(); { ScopedEdition edition(context); - selections.insert(all, effective_mode, true); + selections.insert(all, effective_mode, &insert_pos); } const Buffer& buffer = context.buffer(); Vector<Selection> result; - for (auto& selection : selections) + for (auto& ins_pos : insert_pos) { ByteCount pos = 0; for (auto offset : offsets) { - result.push_back({ buffer.advance(selection.min(), pos), - buffer.advance(selection.min(), offset-1) }); + result.push_back({ buffer.advance(ins_pos, pos), + buffer.advance(ins_pos, offset-1) }); pos = offset; } } |
