Open Arcanemagus opened 8 years ago
The reason behind this was that we dispose the list on mousedown
and were listening for click
event on the list, if we listen for mousedown
instead, we have the expected correct behavior
Managed to break this again on 64b4503c33de301b290b64e893d9c05a24431545:
The menu will go away, but the action isn't triggered.
I'm still experiencing this behavior with 1.1.4 release. The menu only works the first time. The second time it's opened, pressing the key "down" exits the menu and clicking on the menu options do not trigger the actions.
Actually, in my case, the problem is due to a bad interaction with vim-mode-plus
. When pressing Esc
to close the menu, command mode is selected.
It seems, that the intentions menu only works well with vim-mode-plus
when in insert mode.
@pablooliveira You'll have to file an issue on vim-mode-plus
about it breaking other packages...
Actually, I'm not sure which of the two packages is breaking the other. The way intentions catches core:move-up
, core:move-down
actions in lib/commands.js
without declaring explicitly the bindings in keymaps/intentions.json
seems curious.
I found a simple workaround for my issue with vim-mode-plus. The problem is that in command mode, vim-mode-plus remaps the following keys: up, down and escape to its own actions. Therefore intentions do not see the events core:move-up
, core:move-down
ad core:escape
.
I just add the following to my user's keymap.cson
to ensure that when using an intentions-list, escape, down, and up are mapped to core events.
'atom-text-editor.intentions-list:not([mini]):not(.fake-attribute-to-increase-specificity)':
'escape': 'intentions:hide'
'down': 'core:move-down'
'up': 'core:move-up'
I'm hesitant to report this as a bug in vim-mode-plus, because I see nothing wrong in remapping those keys. Shouldn't it be intentions responsability to ensure that when in an intentions-list, the correct events are generated ?
Thx for the workaround. I also had to add 'enter': 'intentions:confirm'
, so in total
'atom-text-editor.intentions-list:not([mini]):not(.fake-attribute-to-increase-specificity)':
'escape': 'intentions:hide'
'down': 'core:move-down'
'up': 'core:move-up'
'enter': 'intentions:confirm
When a menu is presented:
Pressing Enter will apply the fix, but clicking on the item only closes the menu, no action is performed.