support register access through ctrl-r in ncurses_prompt

This commit is contained in:
Maxime Coste 2012-02-13 13:37:41 +00:00
parent 1ef476ed4d
commit 9304e41326

View File

@ -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':