parent
9ca0467c4d
commit
6347787cf2
|
@ -292,6 +292,8 @@ public:
|
||||||
KeymapMode keymap_mode() const override { return KeymapMode::Normal; }
|
KeymapMode keymap_mode() const override { return KeymapMode::Normal; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend struct InputHandler::ScopedForceNormal;
|
||||||
|
|
||||||
NormalParams m_params = { 0, 0 };
|
NormalParams m_params = { 0, 0 };
|
||||||
bool m_hooks_disabled = false;
|
bool m_hooks_disabled = false;
|
||||||
bool m_enabled = false;
|
bool m_enabled = false;
|
||||||
|
@ -1353,14 +1355,16 @@ void InputHandler::on_next_key(KeymapMode keymap_mode, KeyCallback callback)
|
||||||
push_mode(new InputModes::NextKey(*this, keymap_mode, callback));
|
push_mode(new InputModes::NextKey(*this, keymap_mode, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
InputHandler::ScopedForceNormal::ScopedForceNormal(InputHandler& handler)
|
InputHandler::ScopedForceNormal::ScopedForceNormal(InputHandler& handler, NormalParams params)
|
||||||
: m_handler(handler), m_mode(nullptr)
|
: m_handler(handler), m_mode(nullptr)
|
||||||
{
|
{
|
||||||
if (handler.m_mode_stack.size() == 1)
|
if (handler.m_mode_stack.size() != 1)
|
||||||
return;
|
{
|
||||||
|
handler.push_mode(new InputModes::Normal(handler));
|
||||||
|
m_mode = handler.m_mode_stack.back().get();
|
||||||
|
}
|
||||||
|
|
||||||
handler.push_mode(new InputModes::Normal(handler));
|
static_cast<InputModes::Normal*>(handler.m_mode_stack.back().get())->m_params = params;
|
||||||
m_mode = handler.m_mode_stack.back().get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InputHandler::ScopedForceNormal::~ScopedForceNormal()
|
InputHandler::ScopedForceNormal::~ScopedForceNormal()
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
// Force an input handler into normal mode temporarily
|
// Force an input handler into normal mode temporarily
|
||||||
struct ScopedForceNormal
|
struct ScopedForceNormal
|
||||||
{
|
{
|
||||||
ScopedForceNormal(InputHandler& handler);
|
ScopedForceNormal(InputHandler& handler, NormalParams params);
|
||||||
~ScopedForceNormal();
|
~ScopedForceNormal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1508,7 +1508,7 @@ void exec_user_mappings(Context& context, NormalParams params)
|
||||||
auto mapping = context.keymaps().get_mapping(key, KeymapMode::User);
|
auto mapping = context.keymaps().get_mapping(key, KeymapMode::User);
|
||||||
ScopedSetBool disable_keymaps(context.keymaps_disabled());
|
ScopedSetBool disable_keymaps(context.keymaps_disabled());
|
||||||
|
|
||||||
InputHandler::ScopedForceNormal force_normal{context.input_handler()};
|
InputHandler::ScopedForceNormal force_normal{context.input_handler(), params};
|
||||||
|
|
||||||
ScopedEdition edition(context);
|
ScopedEdition edition(context);
|
||||||
for (auto& key : mapping)
|
for (auto& key : mapping)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user