Re: [PATCH] more: ensure that on larger terminals 'h' shows only the in-app help text

Karel Zak <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <xecv6hdqkiyaaoudwlyvnxpqpyjbrqfueoe53f5euorvoefyg6@zgt43jzq6tqj>
On Wed, Mar 19, 2025 at 02:32:28PM +0100, Karel Zak wrote:
> On Tue, Mar 18, 2025 at 12:01:08PM +0100, Benno Schulenberg wrote:
> > When a terminal has more than 24 rows, the rows above the help text
> > (shown by typing 'h' or '?') were still those of the displayed file.
> > That could make it hard to notice that the two lines above the first
> > row of dashes belonged to the help text, not to the displayed file.
> 
> This is a misunderstanding. By default, more(1) is in scroll mode, and
> the help output is added to the display. Therefore, it is expected
> that you see data from the file as well as the help text. You need to
> use -c or -p to clear the screen before it prints the help text.

Note that I agree the output is not very readable, and it would be
better to start the entire help output with a separator, something
like:

diff --git a/text-utils/more.c b/text-utils/more.c
index a035591af..92b257046 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1545,6 +1545,7 @@ static char *find_editor(void)
 
 static void runtime_usage(void)
 {
+	print_separator('-', 79);
 	fputs(_("Most commands optionally preceded by integer argument k.  "
 		"Defaults in brackets.\n"
 		"Star (*) indicates argument becomes new default.\n"), stdout);


-- 
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.