Handle paste before and paster after with p and P
This commit is contained in:
parent
924a85d14f
commit
01018a5eac
|
@ -403,9 +403,13 @@ void do_change(Window& window, int count)
|
||||||
do_insert(window);
|
do_insert(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<bool append>
|
||||||
void do_paste(Window& window, int count)
|
void do_paste(Window& window, int count)
|
||||||
{
|
{
|
||||||
|
if (append)
|
||||||
window.append(RegisterManager::instance()['"']);
|
window.append(RegisterManager::instance()['"']);
|
||||||
|
else
|
||||||
|
window.insert(RegisterManager::instance()['"']);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<char, std::function<void (Window& window, int count)>> keymap =
|
std::unordered_map<char, std::function<void (Window& window, int count)>> keymap =
|
||||||
|
@ -436,7 +440,8 @@ std::unordered_map<char, std::function<void (Window& window, int count)>> keymap
|
||||||
{ 'g', do_go },
|
{ 'g', do_go },
|
||||||
|
|
||||||
{ 'y', do_yank },
|
{ 'y', do_yank },
|
||||||
{ 'p', do_paste },
|
{ 'p', do_paste<true> },
|
||||||
|
{ 'P', do_paste<false> },
|
||||||
|
|
||||||
{ '%', [](Window& window, int count) { window.select(false, [](const BufferIterator& cursor)
|
{ '%', [](Window& window, int count) { window.select(false, [](const BufferIterator& cursor)
|
||||||
{ return Selection(cursor.buffer().begin(), cursor.buffer().end()-1); }); } },
|
{ return Selection(cursor.buffer().begin(), cursor.buffer().end()-1); }); } },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user