1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-19 01:11:36 +03:00

Merge remote-tracking branch 'Delapouite/sels'

This commit is contained in:
Maxime Coste 2018-02-26 11:34:05 +11:00
commit 18f0902824

View File

@ -1737,7 +1737,8 @@ void combine_selections(Context& context, SelectionList list, Func func)
else
{
if (list.size() != sels.size())
throw runtime_error{"The two selection lists don't have the same number of elements"};
throw runtime_error{format("The two selection lists don't have the same number of elements ({} vs {})",
list.size(), sels.size())};
for (int i = 0; i < list.size(); ++i)
combine_selection(sels.buffer(), list[i], sels[i], op);
list.set_main_index(sels.main_index());
@ -1768,7 +1769,9 @@ void save_selections(Context& context, NormalParams params)
context.buffer().name(),
context.buffer().timestamp());
RegisterManager::instance()[reg].set(context, desc);
context.print_status({format("{} selections to register '{}'", combine ? "Combined" : "Saved", reg), get_face("Information")});
context.print_status({format("{} {} selections to register '{}'",
combine ? "Combined" : "Saved", sels.size(), reg),
get_face("Information")});
};
if (combine and not empty)
@ -1784,8 +1787,11 @@ void restore_selections(Context& context, NormalParams params)
auto selections = read_selections_from_register(reg, context);
auto set_selections = [reg](Context& context, SelectionList sels) {
auto size = sels.size();
context.selections_write_only() = std::move(sels);
context.print_status({format("{} selections from register '{}'", combine ? "Combined" : "Restored", reg), get_face("Information")});
context.print_status({format("{} {} selections from register '{}'",
combine ? "Combined" : "Restored", size, reg),
get_face("Information")});
};
if (not combine)