@@ -318,10 +318,7 @@ protected function handleInput(): void
318318 $ this ->cycleSortMode ();
319319 $ this ->syncCursorState ($ this ->visibleDirs ());
320320 } elseif ($ byte === 'S ' ) {
321- $ this ->setSortDirection ('asc ' );
322- $ this ->syncCursorState ($ this ->visibleDirs ());
323- } elseif ($ byte === "\x13" ) {
324- $ this ->setSortDirection ('desc ' );
321+ $ this ->toggleSortDirection ();
325322 $ this ->syncCursorState ($ this ->visibleDirs ());
326323 } elseif ($ byte === 'q ' || $ byte === "\x03" || $ byte === "\x04" ) {
327324 $ this ->running = false ;
@@ -379,7 +376,7 @@ protected function printHeader(): void
379376
380377 protected function printHelp (): void
381378 {
382- $ this ->line (' <fg=gray>↑↓ move <fg=blue>←→ page</> <fg=yellow>s</> field <fg=yellow>S</> asc <fg=yellow>Ctrl-S</> desc <fg=green>space</> delete <fg=red>q</> quit</> ' );
379+ $ this ->line (' <fg=gray>↑↓ move <fg=blue>←→ page</> <fg=yellow>s</> field <fg=yellow>S</> direction <fg=green>space</> delete <fg=red>q</> quit</> ' );
383380 $ this ->newLine ();
384381
385382 $ this ->headerLines += 2 ;
@@ -437,6 +434,11 @@ protected function setSortDirection(string $direction): void
437434 $ this ->sortDirections [$ this ->sortMode ] = $ direction ;
438435 }
439436
437+ protected function toggleSortDirection (): void
438+ {
439+ $ this ->setSortDirection ($ this ->sortDirection () === 'asc ' ? 'desc ' : 'asc ' );
440+ }
441+
440442 /**
441443 * @return string[]
442444 */
@@ -748,7 +750,7 @@ protected function listRowHeight(): int
748750 protected function enableRawMode (): void
749751 {
750752 $ this ->sttyOriginal = trim ((string ) shell_exec ('stty -g 2>/dev/null ' ));
751- shell_exec ('stty -echo -icanon -ixon min 0 time 0 2>/dev/null ' );
753+ shell_exec ('stty -echo -icanon min 0 time 0 2>/dev/null ' );
752754 $ this ->rawModeActive = true ;
753755
754756 $ this ->output ->write ("\033[?25l " );
0 commit comments