Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions keymaps/php-debug.cson
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@
'alt-f6': 'php-debug:stepOver'
'alt-f7': 'php-debug:stepIn'
'alt-f8': 'php-debug:stepOut'

'atom-workspace .php-debug-console atom-text-editor':
'alt-up': 'php-debug:navigatePreviousConsoleCommand'
'alt-down': 'php-debug:navigateNextConsoleCommand'
'up': 'php-debug:navigatePreviousConsoleCommand'
'down': 'php-debug:navigateNextConsoleCommand'
19 changes: 17 additions & 2 deletions lib/console/php-debug-console-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class PhpDebugConsoleView extends ScrollView
super
@GlobalContext = params.context
@visible = false
@stack = []
@curCommand = -1
curHeight = atom.config.get('php-debug.currentConsoleHeight')
if (curHeight)
this.element.style.height = curHeight
Expand Down Expand Up @@ -86,7 +88,6 @@ class PhpDebugConsoleView extends ScrollView
@visible

setVisible: (@visible) =>

if @visible
@panel.show()
else
Expand All @@ -97,13 +98,27 @@ class PhpDebugConsoleView extends ScrollView
expression = @consoleCommandLine
.getModel()
.getText()
# enqueue entered command, limit stack size and update index
@stack.push expression
@stack.shift() if @stack.length > 20
@curCommand = @stack.length
@GlobalContext.notifyConsoleMessage(">" + expression)
@GlobalContext.getCurrentDebugContext()?.evalExpression(expression)

@consoleCommandLine
.getModel()
.setText('')
event.cancel()

isEqual: (other) ->
other instanceof PhpDebugConsoleView

prevCommand: () ->
return unless @stack.length
@curCommand -= 1 if @curCommand > 0
@consoleCommandLine.getModel().setText(@stack[@curCommand])

nextCommand: () ->
return unless @stack.length
len = @stack.length
@curCommand += 1 if @curCommand < len
@consoleCommandLine.getModel().setText(if @curCommand < len then @stack[@curCommand] else '')
8 changes: 8 additions & 0 deletions lib/php-debug.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ module.exports = PhpDebug =
@subscriptions.add atom.commands.add 'atom-workspace', 'php-debug:stepOut': => @stepOut()
@subscriptions.add atom.commands.add 'atom-workspace', 'php-debug:clearAllBreakpoints': => @clearAllBreakpoints()
@subscriptions.add atom.commands.add 'atom-workspace', 'php-debug:clearAllWatchpoints': => @clearAllWatchpoints()
@subscriptions.add atom.commands.add 'atom-workspace', 'php-debug:navigatePreviousConsoleCommand': => @navigatePreviousConsoleCommand()
@subscriptions.add atom.commands.add 'atom-workspace', 'php-debug:navigateNextConsoleCommand': => @navigateNextConsoleCommand()
@subscriptions.add atom.workspace.addOpener (filePath) =>
switch filePath
when PhpDebugContextUri
Expand Down Expand Up @@ -480,3 +482,9 @@ module.exports = PhpDebug =
marker = @addBreakpointMarker(line, editor)
breakpoint.setMarker(marker)
@GlobalContext.addBreakpoint breakpoint

navigatePreviousConsoleCommand: ->
@consoleView.prevCommand()

navigateNextConsoleCommand: ->
@consoleView.nextCommand()