diff --git a/src/packages/command-panel/lib/command-interpreter.coffee b/src/packages/command-panel/lib/command-interpreter.coffee index 8caa07b20..78566c036 100644 --- a/src/packages/command-panel/lib/command-interpreter.coffee +++ b/src/packages/command-panel/lib/command-interpreter.coffee @@ -11,8 +11,10 @@ class CommandInterpreter @lastRelativeAddress = compositeCommand if compositeCommand.isRelativeAddress() compositeCommand.execute(@project, activeEditSession) - repeatRelativeAddress: (activeEditSession) -> - @lastRelativeAddress?.execute(@project, activeEditSession) + repeatRelativeAddress: (activeEditSession, {reverse}={}) -> + return unless @lastRelativeAddress + reverse ?= false + previousSelectionRange = activeEditSession.getSelection().getBufferRange() + address = if reverse then @lastRelativeAddress.reverse() else @lastRelativeAddress - repeatRelativeAddressInReverse: (activeEditSession) -> - @lastRelativeAddress?.reverse().execute(@project, activeEditSession) + address.execute(@project, activeEditSession) \ No newline at end of file diff --git a/src/packages/command-panel/lib/command-panel-view.coffee b/src/packages/command-panel/lib/command-panel-view.coffee index 98004f35b..74806feda 100644 --- a/src/packages/command-panel/lib/command-panel-view.coffee +++ b/src/packages/command-panel/lib/command-panel-view.coffee @@ -44,7 +44,7 @@ class CommandPanelView extends View rootView.command 'command-panel:find-in-file', => @attach('/') rootView.command 'command-panel:find-in-project', => @attach('Xx/') rootView.command 'command-panel:repeat-relative-address', => @repeatRelativeAddress() - rootView.command 'command-panel:repeat-relative-address-in-reverse', => @repeatRelativeAddressInReverse() + rootView.command 'command-panel:repeat-relative-address-in-reverse', => @repeatRelativeAddress(reverse: true) rootView.command 'command-panel:set-selection-as-regex-address', => @setSelectionAsLastRelativeAddress() @on 'click', '.expand', @onExpandAll @@ -157,11 +157,8 @@ class CommandPanelView extends View @historyIndex++ @miniEditor.setText(@history[@historyIndex] or '') - repeatRelativeAddress: -> - @commandInterpreter.repeatRelativeAddress(rootView.getActivePaneItem()) - - repeatRelativeAddressInReverse: -> - @commandInterpreter.repeatRelativeAddressInReverse(rootView.getActivePaneItem()) + repeatRelativeAddress: (options) -> + @commandInterpreter.repeatRelativeAddress(rootView.getActivePaneItem(), options) setSelectionAsLastRelativeAddress: -> selection = rootView.getActiveView().getSelectedText()