Remember count when repeating last insert

Fixes #1465
This commit is contained in:
Maxime Coste 2017-06-25 07:25:31 +01:00
parent 718adc9c88
commit 8a2ece78b7
2 changed files with 4 additions and 3 deletions

View File

@ -1057,6 +1057,7 @@ public:
last_insert().mode = mode;
last_insert().keys.clear();
last_insert().disable_hooks = context().hooks_disabled();
last_insert().count = count;
context().hooks().run_hook("InsertBegin", "", context());
prepare(mode, count);
@ -1435,7 +1436,7 @@ void InputHandler::repeat_last_insert()
m_last_insert.disable_hooks);
// context.last_insert will be refilled by the new Insert
// this is very inefficient.
push_mode(new InputModes::Insert(*this, m_last_insert.mode, 1));
push_mode(new InputModes::Insert(*this, m_last_insert.mode, m_last_insert.count));
for (auto& key : keys)
current_mode().handle_key(key);
kak_assert(dynamic_cast<InputModes::Normal*>(&current_mode()) != nullptr);

View File

@ -116,8 +116,8 @@ private:
void push_mode(InputMode* new_mode);
void pop_mode(InputMode* current_mode);
struct Insertion{ InsertMode mode; Vector<Key> keys; bool disable_hooks; };
Insertion m_last_insert = { InsertMode::Insert, {}, false };
struct Insertion{ InsertMode mode; Vector<Key> keys; bool disable_hooks; int count; };
Insertion m_last_insert = { InsertMode::Insert, {}, false, 1 };
char m_recording_reg = 0;
String m_recorded_keys;