mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Rename @editor to @miniEditor in command panel
This commit is contained in:
@@ -24,7 +24,7 @@ class CommandPanel extends View
|
||||
@content: ->
|
||||
@div class: 'command-panel', =>
|
||||
@div ':', class: 'prompt', outlet: 'prompt'
|
||||
@subview 'editor', new Editor(mini: true)
|
||||
@subview 'miniEditor', new Editor(mini: true)
|
||||
|
||||
commandInterpreter: null
|
||||
history: null
|
||||
@@ -39,24 +39,24 @@ class CommandPanel extends View
|
||||
@rootView.on 'command-panel:find-in-file', => @show("/")
|
||||
@rootView.on 'command-panel:repeat-relative-address', => @repeatRelativeAddress()
|
||||
|
||||
@editor.off 'move-up move-down'
|
||||
@editor.on 'move-up', => @navigateBackwardInHistory()
|
||||
@editor.on 'move-down', => @navigateForwardInHistory()
|
||||
@miniEditor.off 'move-up move-down'
|
||||
@miniEditor.on 'move-up', => @navigateBackwardInHistory()
|
||||
@miniEditor.on 'move-down', => @navigateForwardInHistory()
|
||||
|
||||
toggle: ->
|
||||
if @parent().length then @hide() else @show()
|
||||
|
||||
show: (text='') ->
|
||||
@rootView.append(this)
|
||||
@prompt.css 'font', @editor.css('font')
|
||||
@editor.focus()
|
||||
@editor.buffer.setText(text)
|
||||
@prompt.css 'font', @miniEditor.css('font')
|
||||
@miniEditor.focus()
|
||||
@miniEditor.buffer.setText(text)
|
||||
|
||||
hide: ->
|
||||
@detach()
|
||||
@rootView.activeEditor().focus()
|
||||
|
||||
execute: (command = @editor.getText()) ->
|
||||
execute: (command = @miniEditor.getText()) ->
|
||||
try
|
||||
@commandInterpreter.eval(@rootView.activeEditor(), command)
|
||||
catch error
|
||||
@@ -73,12 +73,12 @@ class CommandPanel extends View
|
||||
navigateBackwardInHistory: ->
|
||||
return if @historyIndex == 0
|
||||
@historyIndex--
|
||||
@editor.setText(@history[@historyIndex])
|
||||
@miniEditor.setText(@history[@historyIndex])
|
||||
|
||||
navigateForwardInHistory: ->
|
||||
return if @historyIndex == @history.length
|
||||
@historyIndex++
|
||||
@editor.setText(@history[@historyIndex] or '')
|
||||
@miniEditor.setText(@history[@historyIndex] or '')
|
||||
|
||||
repeatRelativeAddress: ->
|
||||
@commandInterpreter.repeatRelativeAddress(@rootView.activeEditor())
|
||||
|
||||
Reference in New Issue
Block a user