@@ -34,6 +34,7 @@ let inputModeParams: InputModeParams = {
3434} ;
3535let subgroupOverride : CommandsSubgroup | null = null ;
3636let isAnimating = false ;
37+ let lastSingleListModeInputValue = "" ;
3738
3839function removeCommandlineBackground ( ) : void {
3940 $ ( "#commandLine" ) . addClass ( "noBackground" ) ;
@@ -509,6 +510,9 @@ async function runActiveCommand(): Promise<void> {
509510 command . exec ?.( {
510511 commandlineModal : modal ,
511512 } ) ;
513+ if ( Config . singleListCommandLine === "on" ) {
514+ lastSingleListModeInputValue = inputValue ;
515+ }
512516 const isSticky = command . sticky ?? false ;
513517 if ( ! isSticky ) {
514518 void AnalyticsController . log ( "usedCommandLine" , { command : command . id } ) ;
@@ -574,6 +578,14 @@ function updateInput(setInput?: string): void {
574578 } else {
575579 iconElement . innerHTML = '<i class="fas fa-search"></i>' ;
576580 element . placeholder = "Search..." ;
581+
582+ let length = inputValue . length ;
583+ if ( setInput !== undefined ) {
584+ length = setInput . length ;
585+ }
586+ setTimeout ( ( ) => {
587+ element . setSelectionRange ( length , length ) ;
588+ } , 0 ) ;
577589 }
578590}
579591
@@ -631,6 +643,18 @@ const modal = new AnimatedModal({
631643 ( e . ctrlKey &&
632644 ( e . key . toLowerCase ( ) === "k" || e . key . toLowerCase ( ) === "p" ) )
633645 ) {
646+ if (
647+ Config . singleListCommandLine === "on" &&
648+ inputValue === "" &&
649+ lastSingleListModeInputValue !== ""
650+ ) {
651+ inputValue = lastSingleListModeInputValue ;
652+ updateInput ( ) ;
653+ await filterSubgroup ( ) ;
654+ await showCommands ( ) ;
655+ await updateActiveCommand ( ) ;
656+ return ;
657+ }
634658 e . preventDefault ( ) ;
635659 await decrementActiveIndex ( ) ;
636660 }
0 commit comments