mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-10 15:40:37 +02:00
Remove unnecessary hasmapfrom function
This commit is contained in:
parent
c7bbfdcaf5
commit
fc5aaa50d8
src/main/java/com/maddyhome/idea/vim/extension
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
@ -62,7 +62,7 @@ internal class ParagraphMotion : VimExtension {
|
||||
toKeys: List<KeyStroke>,
|
||||
recursive: Boolean,
|
||||
) {
|
||||
val filteredModes = modes.filterNotTo(HashSet()) { VimPlugin.getKey().hasmapfrom(it, fromKeys) }
|
||||
val filteredModes = modes.filterNotTo(HashSet()) { VimPlugin.getKey().getKeyMapping(it)[fromKeys] != null }
|
||||
putKeyMappingIfMissing(filteredModes, fromKeys, pluginOwner, toKeys, recursive)
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ private fun VimExtension.mapToFunctionAndProvideKeys(
|
||||
VimPlugin.getKey().hasmapto(it, injector.parser.parseKeys(commandFromOriginalPlugin(keys)))
|
||||
}
|
||||
val filteredFromModes = mappingModes.filterNotTo(HashSet()) {
|
||||
injector.keyGroup.hasmapfrom(it, fromKeys)
|
||||
injector.keyGroup.getKeyMapping(it)[fromKeys] != null
|
||||
}
|
||||
|
||||
val doubleFiltered = mappingModes
|
||||
|
@ -61,8 +61,14 @@ interface VimKeyGroup {
|
||||
fun updateShortcutKeysRegistration()
|
||||
fun unregisterCommandActions()
|
||||
fun resetKeyMappings()
|
||||
|
||||
/**
|
||||
* Returns true if there exists a mapping to the given left-hand side keystrokes
|
||||
*
|
||||
* Note that the Vim function `hasmapto()` can accept a set of modes, and checks if any mapping _contains_ the given
|
||||
* left-hand side mapping, rather than is a direct map. (It also handles abbreviations)
|
||||
*/
|
||||
fun hasmapto(mode: MappingMode, toKeys: List<KeyStroke>): Boolean
|
||||
fun hasmapfrom(mode: MappingMode, fromKeys: List<KeyStroke>): Boolean
|
||||
|
||||
val shortcutConflicts: MutableMap<KeyStroke, ShortcutOwnerInfo>
|
||||
val savedShortcutConflicts: MutableMap<KeyStroke, ShortcutOwnerInfo>
|
||||
|
@ -44,10 +44,6 @@ abstract class VimKeyGroupBase : VimKeyGroup {
|
||||
return this.getKeyMapping(mode).hasmapto(toKeys)
|
||||
}
|
||||
|
||||
override fun hasmapfrom(mode: MappingMode, fromKeys: List<KeyStroke>): Boolean {
|
||||
return this.getKeyMapping(mode).hasmapfrom(fromKeys)
|
||||
}
|
||||
|
||||
override fun getKeyMapping(mode: MappingMode): KeyMapping {
|
||||
return keyMappings.getOrPut(mode) { KeyMapping(mode) }
|
||||
}
|
||||
|
@ -135,7 +135,5 @@ class KeyMapping(private val mode: MappingMode) : Iterable<List<KeyStroke>>, Key
|
||||
mappingInfo is ToKeysMappingInfo && mappingInfo.toKeys == toKeys
|
||||
}
|
||||
|
||||
fun hasmapfrom(fromKeys: List<KeyStroke>) = keysTrie.getData(fromKeys) != null
|
||||
|
||||
override fun getLayer(keys: List<KeyStroke>): MappingInfoLayer? = get(keys)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user