File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 3434 ' alt-f6' : ' php-debug:stepOver'
3535 ' alt-f7' : ' php-debug:stepIn'
3636 ' alt-f8' : ' php-debug:stepOut'
37+
38+ ' atom-workspace .php-debug-console atom-text-editor' :
39+ ' alt-up' : ' php-debug:navigatePreviousConsoleCommand'
40+ ' alt-down' : ' php-debug:navigateNextConsoleCommand'
41+ ' up' : ' php-debug:navigatePreviousConsoleCommand'
42+ ' down' : ' php-debug:navigateNextConsoleCommand'
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ class PhpDebugConsoleView extends ScrollView
2323 super
2424 @GlobalContext = params .context
2525 @visible = false
26+ @stack = []
27+ @curCommand = - 1
2628 curHeight = atom .config .get (' php-debug.currentConsoleHeight' )
2729 if (curHeight)
2830 this .element .style .height = curHeight
@@ -86,7 +88,6 @@ class PhpDebugConsoleView extends ScrollView
8688 @visible
8789
8890 setVisible : (@visible ) =>
89-
9091 if @visible
9192 @panel .show ()
9293 else
@@ -97,13 +98,27 @@ class PhpDebugConsoleView extends ScrollView
9798 expression = @consoleCommandLine
9899 .getModel ()
99100 .getText ()
101+ # enqueue entered command, limit stack size and update index
102+ @stack .push expression
103+ @stack .shift () if @stack .length > 20
104+ @curCommand = @stack .length
100105 @GlobalContext .notifyConsoleMessage (" >" + expression)
101106 @GlobalContext .getCurrentDebugContext ()? .evalExpression (expression)
102-
103107 @consoleCommandLine
104108 .getModel ()
105109 .setText (' ' )
106110 event .cancel ()
107111
108112 isEqual : (other ) ->
109113 other instanceof PhpDebugConsoleView
114+
115+ prevCommand : () ->
116+ return unless @stack .length
117+ @curCommand -= 1 if @curCommand > 0
118+ @consoleCommandLine .getModel ().setText (@stack [@curCommand ])
119+
120+ nextCommand : () ->
121+ return unless @stack .length
122+ len = @stack .length
123+ @curCommand += 1 if @curCommand < len
124+ @consoleCommandLine .getModel ().setText (if @curCommand < len then @stack [@curCommand ] else ' ' )
Original file line number Diff line number Diff line change @@ -157,6 +157,8 @@ module.exports = PhpDebug =
157157 @subscriptions .add atom .commands .add ' atom-workspace' , ' php-debug:stepOut ' : => @ stepOut ()
158158 @subscriptions .add atom .commands .add ' atom-workspace' , ' php-debug:clearAllBreakpoints ' : => @ clearAllBreakpoints ()
159159 @subscriptions .add atom .commands .add ' atom-workspace' , ' php-debug:clearAllWatchpoints ' : => @ clearAllWatchpoints ()
160+ @subscriptions .add atom .commands .add ' atom-workspace' , ' php-debug:navigatePreviousConsoleCommand ' : => @ navigatePreviousConsoleCommand ()
161+ @subscriptions .add atom .commands .add ' atom-workspace' , ' php-debug:navigateNextConsoleCommand ' : => @ navigateNextConsoleCommand ()
160162 @subscriptions .add atom .workspace .addOpener (filePath) =>
161163 switch filePath
162164 when PhpDebugContextUri
@@ -480,3 +482,9 @@ module.exports = PhpDebug =
480482 marker = @ addBreakpointMarker (line, editor)
481483 breakpoint .setMarker (marker)
482484 @GlobalContext .addBreakpoint breakpoint
485+
486+ navigatePreviousConsoleCommand : ->
487+ @consoleView .prevCommand ()
488+
489+ navigateNextConsoleCommand : ->
490+ @consoleView .nextCommand ()
You can’t perform that action at this time.
0 commit comments