Support appending selections to empty register

Fixes #1332
This commit is contained in:
Maxime Coste 2017-04-25 17:25:44 +01:00
parent 0dc16b8c31
commit 80f1056851

View File

@ -1539,7 +1539,10 @@ void save_selections(Context& context, NormalParams params)
throw runtime_error("selections can only be saved to the '^' and alphabetic registers");
auto gen_desc = [&] {
if (not add)
auto content = RegisterManager::instance()[reg].get(context);
const bool empty = content.size() == 1 and content[0].empty();
if (not add or empty)
return selection_list_to_string(context.selections());
auto selections = read_selections_from_register(reg, context);