mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-26 08:03:17 +03:00
Remove getAllKeyMappings
This commit is contained in:
parent
dd0938dca6
commit
c43f277c5b
@ -323,17 +323,6 @@ describe "Keymap", ->
|
||||
expect(Object.keys(bindings).length).toBe 1
|
||||
expect(bindings['g']).toEqual "command-and-grandchild-node"
|
||||
|
||||
describe ".getAllKeyMappings", ->
|
||||
it "returns the all bindings", ->
|
||||
keymap.bindKeys path.join('~', '.atom', 'packages', 'dummy', 'keymaps', 'a.cson'), '.command-mode', 'k': 'c'
|
||||
|
||||
mappings = keymap.getAllKeyMappings()
|
||||
expect(mappings.length).toBe 1
|
||||
expect(mappings[0].source).toEqual 'dummy'
|
||||
expect(mappings[0].keystroke).toEqual 'k'
|
||||
expect(mappings[0].command).toEqual 'c'
|
||||
expect(mappings[0].selector).toEqual '.command-mode'
|
||||
|
||||
describe ".determineSource", ->
|
||||
describe "for a package", ->
|
||||
it "returns '<package-name>'", ->
|
||||
|
@ -61,29 +61,6 @@ class Keymap
|
||||
firstKeystroke = keystroke.split(' ')[0]
|
||||
_.remove(@bindingSetsByFirstKeystroke[firstKeystroke], bindingSet)
|
||||
|
||||
# Private: Returns a user friendly description of where a keybinding was
|
||||
# loaded from.
|
||||
#
|
||||
# * filePath:
|
||||
# The absolute path from which the keymap was loaded
|
||||
#
|
||||
# Returns one of:
|
||||
# * `Core` indicates it comes from a bundled package.
|
||||
# * `User` indicates that it was defined by a user.
|
||||
# * `<package-name>` the package which defined it.
|
||||
# * `Unknown` if an invalid path was passed in.
|
||||
determineSource: (filePath) ->
|
||||
return 'Unknown' unless filePath
|
||||
|
||||
pathParts = filePath.split(path.sep)
|
||||
if _.contains(pathParts, 'node_modules') or _.contains(pathParts, 'atom') or _.contains(pathParts, 'src')
|
||||
'Core'
|
||||
else if _.contains(pathParts, '.atom') and _.contains(pathParts, 'keymaps') and !_.contains(pathParts, 'packages')
|
||||
'User'
|
||||
else
|
||||
packageNameIndex = pathParts.length - 3
|
||||
pathParts[packageNameIndex]
|
||||
|
||||
bindKeys: (args...) ->
|
||||
name = args.shift() if args.length > 2
|
||||
[selector, bindings] = args
|
||||
@ -129,6 +106,9 @@ class Keymap
|
||||
|
||||
shouldBubble ? true
|
||||
|
||||
# Public: Returns an array of objects that represent every keystroke to
|
||||
# command mapping. Each object contains the following keys `source`,
|
||||
# `selector`, `command`, `keystroke`, `index`, `specificity`.
|
||||
allMappings: ->
|
||||
mappings = []
|
||||
|
||||
@ -217,14 +197,6 @@ class Keymap
|
||||
# Deprecated
|
||||
#
|
||||
|
||||
# Public: Returns an array of objects that represent every keystroke to
|
||||
# command mapping. Each object contains the following keys `source`,
|
||||
# `selector`, `command`, `keystroke`.
|
||||
getAllKeyMappings: ->
|
||||
@allMappings().map (mapping) =>
|
||||
mapping.source = @determineSource(mapping.source)
|
||||
mapping
|
||||
|
||||
bindingsForElement: (element) ->
|
||||
keystrokeMap = {}
|
||||
mappings = @mappingsMatchingElement(@allMappings(), element)
|
||||
|
Loading…
Reference in New Issue
Block a user