Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Hitting an unbound key sequence sharing a prefix with a bound sequence freezes atom #11203

Closed
atom/atom-keymap
#124

Description

@dpavlic

Prerequisites

I am not sure if this issue fits here or over at https://github.com/atom/atom-keymap, apologies.

Description

Atom freezes or crashes when a non-bound key binding shares the same prefix as a bound key binding.

Steps to Reproduce

  1. Create an example keybinding in your keymap file; (this is a trivial example; while they make Atom effectively non-functional, these types of bindings are, I expect, not so uncommon for us vim mode folk):
    'atom-text-editor':
      'space b d': 'tabs:close-tab'
  1. Hitting space, b, d will delete the tab as expected.
  2. Now: instead, hit space b y (or any other unbound key).

Expected behavior: Nothing happens.

Actual behavior: Atom freezes for an extended time. Attempting this in safe mode crashes, otherwise it freezes and eventually shows a stack trace referenced in #6102. However, this does not appear to be the same issue from what is being discussed there. Development console in addition shows:

    Uncaught exception
        module.exports.KeymapManager.simulateTextInput @ (program):446
    Uncaught RangeError: Maximum call stack size exceeded
        /usr/lib/atom/node_modules/atom-keymap/lib/keymap-manager.js:459

Versions

Affects 1.6.0 and 1.5.4. Downgrading to 1.5.3 solves the issue.

Activity

  1. BinaryMuse commented on Mar 18, 2016

    @BinaryMuse
    Contributor

    Thanks for the report! A similar issue came up in the #atom Slack channel as well, I'll take a look at this soon.

  2. dpavlic commented on Mar 20, 2016

    @dpavlic
    Author

    An additional note: it seems to me that I need to have a bound / unbound shortcut of >=3 characters to trigger this. Almost all of my prefixes, as a result of vim mode, start with space (space being a pseudo leader key): for example: space g s for git status. However, if I press space, followed by the next letter which has no bindings (e.g., I have nothing that starts with space y), then there is no problem.

  3. jessejanderson commented on Mar 23, 2016

    @jessejanderson

    Man, this bug is brutal—apparently I press a lot of incorrect shortcut keys.

    Having to force quit Atom several times a day in it's current state.

  4. dragonxlwang commented on Mar 23, 2016

    @dragonxlwang

    Thanks @dpavlic for pointing me to the correct place.

    Hope this issue to get fixed soon as I am a sloppy typing guy

  5. BinaryMuse commented on Mar 24, 2016

    @BinaryMuse
    Contributor

    I haven't had a chance to dive into this deeply yet, but anecdotally, the three or four times I've heard this reported, the leader key has been the space key.

  6. calebmeyer commented on Mar 24, 2016

    @calebmeyer

    @BinaryMuse I can confirm that this only happens with the space key as the leader key. I added
    ', r t': 'rspec:run-for-line' to my keymap.cson, then hit comma r f and atom did not crash.

  7. dpavlic commented on Mar 24, 2016

    @dpavlic
    Author

    @BinaryMuse Changing the leader seems to stop the behaviour on this end as well. I'm going to remap the leader for now and test it out some more.

  8. dpavlic commented on Mar 24, 2016

    @dpavlic
    Author

    I was too hasty, remapping all the keys to the comma brings the problem back...

  9. dragonxlwang commented on Mar 24, 2016

    @dragonxlwang

    @dpavlic In my case I was using "," for leader key in vim-mode and I got this problem all the time after updating.

  10. jackcasey commented on Mar 30, 2016

    @jackcasey

    Hi, I've managed to write a failing spec ** in atom-keymap. See the PR referenced above.

    Update: Sorry closed that PR above, the fix was causing replayed input events to double up. I've also made the spec failure case a very simple new keybind that interferes with the d o g case' rather than new cases.

    Anyone feel free to carry on where I've left off. I think we need to maintain the disabled binds between replays somehow, but without breaking the replay system. As the source suggest, there are dragons.

  11. nathansobo commented on Mar 30, 2016

    @nathansobo
    Contributor

    This was caused by an unforeseen corner of @benogle's changes to support keyup events, which is used in MRU tabs. I'm looking into a quick solution, but keystroke matching needs a rethink.

  12. nathansobo commented on Mar 30, 2016

    @nathansobo
    Contributor

    Okay, I fixed at least one issue in 1.7.0-beta4. Can folks give it a try and comment here if there are other cases I missed? Keymap matching code is reaching critical crazy.

  13. dpavlic commented on Mar 31, 2016

    @dpavlic
    Author

    All looks good so far on the 1.7.0-beta4. Thank you nathansobo and jackcasey.

  14. jackcasey commented on Apr 4, 2016

    @jackcasey

    Yay! Thanks for the fix. All works for me. Will save me 10 sighs a day at least :)

  15. lock commented on Apr 10, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  16. locked and limited conversation to collaborators on Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions