From e568231fe3addd0804e1adcfbbe1c763ca311f8e Mon Sep 17 00:00:00 2001 From: Delapouite Date: Fri, 23 Feb 2018 22:49:42 +0100 Subject: [PATCH] Display number of combined/saved/restored selections in status --- src/normal.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index bd07826c4..5d1f9f0f8 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1740,7 +1740,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()); @@ -1771,7 +1772,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) @@ -1787,8 +1790,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)