Reset normal mode when changing the current editor

This commit is contained in:
Maxime Coste 2013-10-15 18:50:43 +01:00
parent 608196f526
commit fe0a4f0d11
4 changed files with 11 additions and 2 deletions

View File

@ -937,7 +937,7 @@ private:
InputMode& InputMode::reset_normal_mode() InputMode& InputMode::reset_normal_mode()
{ {
m_client.change_input_mode(new InputModes::Normal(m_client)); m_client.reset_normal_mode();
return *m_client.m_mode; return *m_client.m_mode;
} }
@ -1090,4 +1090,9 @@ void Client::redraw_ifn()
} }
} }
void Client::reset_normal_mode()
{
change_input_mode(new InputModes::Normal(*this));
}
} }

View File

@ -85,6 +85,8 @@ public:
void redraw_ifn(); void redraw_ifn();
UserInterface& ui() const { return *m_ui; } UserInterface& ui() const { return *m_ui; }
void reset_normal_mode();
private: private:
void change_input_mode(InputMode* new_mode); void change_input_mode(InputMode* new_mode);

View File

@ -153,6 +153,8 @@ void Context::change_editor(Editor& editor)
window().set_dimensions(ui().dimensions()); window().set_dimensions(ui().dimensions());
window().hooks().run_hook("WinDisplay", buffer().name(), *this); window().hooks().run_hook("WinDisplay", buffer().name(), *this);
} }
if (has_client())
client().reset_normal_mode();
} }
} }

View File

@ -57,7 +57,7 @@ struct Context
void forget_jumps_to_buffer(Buffer& buffer); void forget_jumps_to_buffer(Buffer& buffer);
private: private:
safe_ptr<Editor> m_editor; safe_ptr<Editor> m_editor;
safe_ptr<Client> m_client; safe_ptr<Client> m_client;
using JumpList = std::vector<DynamicSelectionList>; using JumpList = std::vector<DynamicSelectionList>;