summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-02-13 13:37:41 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-02-13 13:37:41 +0000
commit9304e41326fd71ab9e336b4ebe923c3ab19b1bbf (patch)
tree29eb8545f68f32dcd4f9e6e14570e3be1a97067c /src
parent1ef476ed4d5e9290316143c278c2fcf1dbda471f (diff)
support register access through ctrl-r in ncurses_prompt
Diffstat (limited to 'src')
-rw-r--r--src/main.cc11
1 files changed, 11 insertions, 0 deletions
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 <mach-o/dyld.h>
#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':