File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,10 @@ public function deleteChar($n)
588588 */
589589 protected function processLine ()
590590 {
591+ // reset history cycle position
592+ $ this ->historyPosition = null ;
593+ $ this ->historyUnsaved = null ;
594+
591595 // store and reset/clear/redraw current input
592596 $ line = $ this ->linebuffer ;
593597 if ($ line !== '' ) {
Original file line number Diff line number Diff line change @@ -678,6 +678,20 @@ public function testHistoryUpBeyondTopCyclesToFirst()
678678 $ this ->assertEquals ('a ' , $ this ->readline ->getInput ());
679679 }
680680
681+ public function testHistoryUpAndThenEnterRestoresCycleToBottom ()
682+ {
683+ $ this ->readline ->addHistory ('a ' );
684+ $ this ->readline ->addHistory ('b ' );
685+
686+ $ this ->readline ->onKeyUp ();
687+
688+ $ this ->readline ->onKeyEnter ();
689+
690+ $ this ->readline ->onKeyUp ();
691+
692+ $ this ->assertEquals ('b ' , $ this ->readline ->getInput ());
693+ }
694+
681695 public function testHistoryDownNotCyclingDoesNotChangeInput ()
682696 {
683697 $ this ->readline ->onKeyDown ();
You can’t perform that action at this time.
0 commit comments