Skip to content

Commit

Permalink
Do not resolve keymap in the middle of sequence in command-based modes.
Browse files Browse the repository at this point in the history
This fixes issues when subsequence is matching a top level mapping:
nmap ]] :nextmember<CR>
Will break ci] or '].
  • Loading branch information
igrekster committed Jun 5, 2013
1 parent db94676 commit d089258
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -315,7 +315,11 @@ private void reset() {
}

public KeyMap resolveKeyMap(KeyMapProvider provider) {
return provider.getKeyMap(keyMapResolver.getKeyMapName());
if (currentState == initialState) {
return provider.getKeyMap(keyMapResolver.getKeyMapName());
} else {
return null;
}
}

public void leaveMode(ModeSwitchHint... hints) throws CommandExecutionException {
Expand Down

2 comments on commit d089258

@albertdev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igrekster

I was looking at the history to find any changes to the resolveKeyMap method to see what would best fix #409 or #411.

Do you remember if you had any other issues, or maybe if switching to :nnoremap fixed this issue? I'm trying to put this into a test class, and it might be interesting to cover your use case.

I am also asking this because this commit was later reverted in commit fa74be5 and I'm curious whether this bug reappeared or not.

@igrekster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertdev, :nnoremap definitely wouldn't have fixed the issue as it is the method I map all of my keys. :nmap on the other hand could have. I can't recall any other related issues.

fa74be5 is doing a very similar thing but on a much narrower scope -- only when the current sequence expects an operator (I think, as keymap-related code is very confusing to me).

Please sign in to comment.