File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
resources/scripts/components/server Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,16 @@ export default () => {
8080 TERMINAL_PRELUDE + 'Server marked as ' + state + '...\u001b[0m' ,
8181 ) ;
8282
83- const handleCommandKeydown = ( e : React . KeyboardEvent < HTMLInputElement > ) => {
83+ const handleCommandKeyDown = ( e : React . KeyboardEvent < HTMLInputElement > ) => {
8484 if ( e . key === 'ArrowUp' ) {
8585 const newIndex = Math . min ( historyIndex + 1 , history ! . length - 1 ) ;
8686
8787 setHistoryIndex ( newIndex ) ;
8888 e . currentTarget . value = history ! [ newIndex ] || '' ;
89+
90+ // By default up arrow will also bring the cursor to the start of the line,
91+ // so we'll preventDefault to keep it at the end.
92+ e . preventDefault ( ) ;
8993 }
9094
9195 if ( e . key === 'ArrowDown' ) {
@@ -185,7 +189,7 @@ export default () => {
185189 type = { 'text' }
186190 disabled = { ! instance || ! connected }
187191 css = { tw `bg-transparent text-neutral-100 p-2 pl-0 w-full` }
188- onKeyDown = { e => handleCommandKeydown ( e ) }
192+ onKeyDown = { handleCommandKeyDown }
189193 />
190194 </ div >
191195 </ div >
You can’t perform that action at this time.
0 commit comments