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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Improve upon this by scrolling off any lines above the 23-line help
text.

Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxx>
---
 text-utils/more.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/text-utils/more.c b/text-utils/more.c
index a035591af..d0fd6a48f 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1805,6 +1805,8 @@ static int more_key_command(struct more_control *ctl, char *filename)
 		case more_kc_help:
 			if (ctl->no_scroll)
 				more_clear_screen(ctl);
+			else for (int i = ctl->lines_per_page; i > 23; i--)
+				putchar('\n');
 			erase_to_col(ctl, 0);
 			runtime_usage();
 			output_prompt(ctl, filename);
-- 
2.48.1





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux