From 9304e41326fd71ab9e336b4ebe923c3ab19b1bbf Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 13 Feb 2012 13:37:41 +0000 Subject: [PATCH] support register access through ctrl-r in ncurses_prompt --- src/main.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.cc b/src/main.cc index 67dd244e..c40124ab 100644 --- a/src/main.cc +++ b/src/main.cc @@ -27,6 +27,8 @@ #include #endif +#define CTRL(x) x - 'a' + 1 + using namespace Kakoune; using namespace std::placeholders; @@ -292,6 +294,15 @@ std::string ncurses_prompt(const std::string& text, Completer completer = comple current_completion = -1; break; + case CTRL('r'): + { + c = getch(); + std::string reg = RegisterManager::instance()[c].get(); + current_completion = -1; + result = result.substr(0, cursor_pos) + reg + result.substr(cursor_pos, std::string::npos); + cursor_pos += reg.length(); + } + break; case 27: throw prompt_aborted(); case '\t':