From d87ee212bac837f59d62598391b4264db80d4b36 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 30 Jun 2022 16:36:12 +1000 Subject: [PATCH] Insert all register values in prompt after when Alt-modified `` will insert all selections joined by space instead of only the main one as `.` would. --- doc/pages/keys.asciidoc | 4 +++- src/input_handler.cc | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/pages/keys.asciidoc b/doc/pages/keys.asciidoc index e26d6925..d5807d79 100644 --- a/doc/pages/keys.asciidoc +++ b/doc/pages/keys.asciidoc @@ -798,7 +798,9 @@ The following keys are recognized by this mode to help with editing select previous completion candidate **:: - insert then content of the register given by next key + insert then content of the register given by next key, if next key + has the Alt modifier, it will insert all values in the register + joined with spaces, else it will insert the main one **:: insert next keystroke without interpreting it diff --git a/src/input_handler.cc b/src/input_handler.cc index ec8ff3b4..9fab9ccd 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -826,11 +826,16 @@ public: { on_next_key_with_autoinfo(context(), "register", KeymapMode::None, [this](Key key, Context&) { + const bool joined = (bool)(key.modifiers & Key::Modifiers::Alt); + key.modifiers &= ~Key::Modifiers::Alt; + auto cp = key.codepoint(); if (not cp or key == Key::Escape) return; - StringView reg = context().main_sel_register_value(String{*cp}); - m_line_editor.insert(reg); + + m_line_editor.insert( + joined ? join(RegisterManager::instance()[*cp].get(context()), ' ', false) + : context().main_sel_register_value(String{*cp})); display(); m_line_changed = true;