mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge remote-tracking branch 'origin/master' into ns-teleditor
This commit is contained in:
@@ -24,41 +24,14 @@ tooltipDefaults =
|
||||
placement: 'auto top'
|
||||
viewportPadding: 2
|
||||
|
||||
modifiers =
|
||||
cmd: '⌘'
|
||||
ctrl: '⌃'
|
||||
alt: '⌥'
|
||||
option: '⌥'
|
||||
shift: '⇧'
|
||||
enter: '⏎'
|
||||
left: '←'
|
||||
right: '→'
|
||||
up: '↑'
|
||||
down: '↓'
|
||||
|
||||
replaceKey = (key) ->
|
||||
if modifiers[key]
|
||||
modifiers[key]
|
||||
else if key.length == 1 and key == key.toUpperCase() and key.toUpperCase() != key.toLowerCase()
|
||||
[modifiers.shift, key.toUpperCase()]
|
||||
else if key.length == 1
|
||||
key.toUpperCase()
|
||||
else
|
||||
key
|
||||
|
||||
replaceModifiersInSingleKeystroke = (keystroke) ->
|
||||
keys = keystroke.split('-')
|
||||
keys = _.flatten(replaceKey(key) for key in keys)
|
||||
keys.join('')
|
||||
|
||||
replaceModifiers = (keystroke) ->
|
||||
humanizeKeystrokes = (keystroke) ->
|
||||
keystrokes = keystroke.split(' ')
|
||||
keystrokes = (replaceModifiersInSingleKeystroke(stroke) for stroke in keystrokes)
|
||||
keystrokes = (_.humanizeKeystroke(stroke) for stroke in keystrokes)
|
||||
keystrokes.join(' ')
|
||||
|
||||
getKeystroke = (bindings) ->
|
||||
if bindings?.length
|
||||
"<span class=\"keystroke\">#{replaceModifiers(bindings[0].keystroke)}</span>"
|
||||
"<span class=\"keystroke\">#{humanizeKeystrokes(bindings[0].keystroke)}</span>"
|
||||
else
|
||||
''
|
||||
# options from http://getbootstrap.com/javascript/#tooltips
|
||||
@@ -87,6 +60,6 @@ jQuery.fn.destroyTooltip = ->
|
||||
@tooltip('destroy')
|
||||
|
||||
jQuery.fn.setTooltip.getKeystroke = getKeystroke
|
||||
jQuery.fn.setTooltip.replaceModifiers = replaceModifiers
|
||||
jQuery.fn.setTooltip.humanizeKeystrokes = humanizeKeystrokes
|
||||
|
||||
module.exports = spacePen
|
||||
|
||||
@@ -122,8 +122,6 @@ class WorkspaceView extends View
|
||||
@command 'window:save-all', => @saveAll()
|
||||
@command 'window:toggle-invisibles', =>
|
||||
atom.config.toggle("editor.showInvisibles")
|
||||
@command 'window:toggle-ignored-files', =>
|
||||
atom.config.toggle("core.hideGitIgnoredFiles")
|
||||
|
||||
@command 'window:toggle-auto-indent', =>
|
||||
atom.config.toggle("editor.autoIndent")
|
||||
|
||||
Reference in New Issue
Block a user