From 02ff8295ef798f1df703fc71bb52b7472fd417d6 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Fri, 27 Feb 2026 22:42:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhelp=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildTime.txt | 2 +- GitCommit.txt | 2 +- shell/Commands/Help/Help.cs | 20 ++++++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/BuildTime.txt b/BuildTime.txt index 621a720..f2b33e9 100644 --- a/BuildTime.txt +++ b/BuildTime.txt @@ -1 +1 @@ -2026-02-27 22:33:00 \ No newline at end of file +2026-02-27 22:39:48 \ No newline at end of file diff --git a/GitCommit.txt b/GitCommit.txt index 81c28ba..4b426de 100644 --- a/GitCommit.txt +++ b/GitCommit.txt @@ -1 +1 @@ -fefb7e7 \ No newline at end of file +b67e0e7 \ No newline at end of file diff --git a/shell/Commands/Help/Help.cs b/shell/Commands/Help/Help.cs index c7c9f28..18e23a0 100644 --- a/shell/Commands/Help/Help.cs +++ b/shell/Commands/Help/Help.cs @@ -403,7 +403,7 @@ namespace CMLeonOS.Commands { Command = "help", Parameters = "", - Description = "Show help page (1-3)", + Description = "Show help page (1-4)", SubCommands = new[] { new SubCommandInfo { Command = "help all", Description = "Show all help pages" } } } }; @@ -483,24 +483,32 @@ namespace CMLeonOS.Commands pageNumber = 1; } - int startIndex = (pageNumber - 1) * CommandsPerPage; - int endIndex = Math.Min(startIndex + CommandsPerPage, allCommands.Count); - Console.WriteLine("===================================="); Console.WriteLine($" Help - Page {pageNumber}/{totalPages}"); Console.WriteLine("===================================="); Console.WriteLine(); int linesOnPage = 0; - for (int i = startIndex; i < endIndex; i++) + int currentLine = 0; + + for (int i = 0; i < allCommands.Count; i++) { int cmdLines = GetCommandLinesCount(allCommands[i]); - if (linesOnPage + cmdLines > CommandsPerPage) + + if (currentLine + cmdLines <= (pageNumber - 1) * CommandsPerPage) + { + currentLine += cmdLines; + continue; + } + + if (linesOnPage >= CommandsPerPage) { break; } + DisplayCommand(allCommands[i]); linesOnPage += cmdLines; + currentLine += cmdLines; } if (pageNumber < totalPages)