Fix(VIM-4104): Allow Tab to move to next component#1446
Fix(VIM-4104): Allow Tab to move to next component#1446citizenmatt wants to merge 2 commits intoJetBrains:masterfrom
Conversation
c97e5a1 to
ace2a25
Compare
| if (injector.keyGroup.getKeyMapping(MappingMode.INSERT).get(listOf(keyStroke)) == null) { | ||
| if (editor.isOneLineMode || (editor as? EditorEx)?.isEmbeddedIntoDialogWrapper == true || editor.isViewer) { |
There was a problem hiding this comment.
Just a nitpick maybe extract injector.keyGroup.getKeyMapping(MappingMode.INSERT).get(listOf(keyStroke)) == null to seperate method hasInsertMapping or something like that and join into second if so we won't need nested if statement.
Btw have you chacked how it behaves for other onle line editors?
There was a problem hiding this comment.
Yep, I'll get it updated, and I'll double check with other one-line editors
There was a problem hiding this comment.
Actually, I don't think we enable Vim features in any editors other than main and commit now, right?
There was a problem hiding this comment.
Added function to check for mappings. It's essentially the same as maparg(), so you can probably guess what my next PR will be 😁
a60d435 to
13c4b95
Compare
When IdeaVim is not active, and the current editor is single line, or hosted in a dialog/tool window, or a readonly viewer (e.g. the Commit tool window editor), then hitting Tab will move focus to the next component rather than inserting a tab character. When IdeaVim is active, Tab does nothing (in Insert mode) because the
VimShortcutKeyActionhandles the keystroke, passing it through the key handler pipeline and then trying to invoke the (disabled)TabActionplatform action to insert the tab character.This PR fixes this behaviour by making
VimShortcutKeyActiondisabled if the above conditions are met. Since no actions are enabled, Swing will handle the keystroke.IdeaVim will not disable the action if the user has explicitly created an (Insert mode) map for Tab; if the user has explicitly set up a map, we should use it. The IdeaVim action is also only disabled in Insert mode, because Tab is a valid command in Normal. Admittedly, this command is navigating the jump list, and is unlikely in a single line or hosted editor. We could consider allowing this extra behaviour in Normal (or more) modes.
Fixes VIM-4104.