Rotate through strings when pasting instead of repeating the last

This seems like a better overall behaviour.

Closes #5135
This commit is contained in:
Maxime Coste 2024-04-11 10:44:22 +10:00
parent e34735a350
commit 7f556c1e87

View File

@ -694,7 +694,7 @@ void paste(Context& context, NormalParams params)
ScopedEdition edition(context); ScopedEdition edition(context);
ScopedSelectionEdition selection_edition{context}; ScopedSelectionEdition selection_edition{context};
context.selections().for_each([&, last=BufferCoord{}](size_t index, Selection& sel) mutable { context.selections().for_each([&, last=BufferCoord{}](size_t index, Selection& sel) mutable {
auto& str = strings[std::min(strings.size()-1, index)]; auto& str = strings[index % strings.size()];
auto& min = sel.min(); auto& min = sel.min();
auto& max = sel.max(); auto& max = sel.max();
BufferRange range = (mode == PasteMode::Replace) ? BufferRange range = (mode == PasteMode::Replace) ?