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