Skip to content

Re-enter or nested layers cause unexpected key mapping #3

@dengzhizhi

Description

@dengzhizhi

Thanks for the great plugin!

Currently it allows enter another layer when you already in one, or reenter the same layer again, but when you exit the layers in reverse order the keymap won't correctly restore, e.g. the ESC key still map to one of the on_exit callback and keep calling it even no layers activated. Or in some case I couldn't use ESC to exit a layer because it gets overwritten by a nested layer.

If nested layers is not gracefully supported, can we always exit the previous one when entering a new layer? I tried to add following code in the on_enter function but it doesn't help.

if _G.active_keymap_layer then
    _G.active_keymap_layer:exit()
end

I guess at the point when on_enter is called, the storage for restoring keymaps (and options) has already been overwritten, it need to be done inside the plugin.

If there is an intention to gracefully support nested layer in the future, can we have an allow_nested option in the config for now so that it is either

  • not allow entering another layer before the current one is exited; or
  • always exit the current layer before entering a new one.

I think such option would usefully even when nesting is supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions