From 80f1056851d07ba9b2bcc04df818202a5d9a3495 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 25 Apr 2017 17:25:44 +0100 Subject: [PATCH] Support appending selections to empty register Fixes #1332 --- src/normal.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/normal.cc b/src/normal.cc index aa7ec225..bd124ff6 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -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);