File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ const Terminal = ({
121121 // history update
122122 setHistory ( ( previousHistory ) =>
123123 currentLineInput . trim ( ) === "" ||
124- previousHistory [ previousHistory . length - 1 ] === currentLineInput . trim ( )
124+ previousHistory [ previousHistory . length - 1 ] === currentLineInput . trim ( )
125125 ? previousHistory
126126 : [ ...previousHistory , currentLineInput ] ,
127127 ) ;
@@ -141,7 +141,6 @@ const Terminal = ({
141141 event . key ,
142142 )
143143 ) {
144- event . preventDefault ( ) ;
145144 const inputElement = event . currentTarget ;
146145 let charsToRightOfCursor = "" ;
147146 let cursorIndex =
@@ -158,10 +157,12 @@ const Terminal = ({
158157 currentLineInput . length - cursorIndex + 1 ,
159158 ) ;
160159 } else if ( event . key === "ArrowUp" ) {
161- charsToRightOfCursor = currentLineInput . slice ( 0 ) ;
160+ event . preventDefault ( ) ;
161+ charsToRightOfCursor = currentLineInput . slice ( currentLineInput . length ) ;
162162 changeHistoryIndex ( - 1 ) ;
163163 } else if ( event . key === "ArrowDown" ) {
164- charsToRightOfCursor = currentLineInput . slice ( 0 ) ;
164+ event . preventDefault ( ) ;
165+ charsToRightOfCursor = currentLineInput . slice ( currentLineInput . length ) ;
165166 changeHistoryIndex ( 1 ) ;
166167 }
167168
You can’t perform that action at this time.
0 commit comments