]> git.ipfire.org Git - thirdparty/util-linux.git/commit
more: fix repeat command
authorKarel Zak <kzak@redhat.com>
Mon, 17 Mar 2025 10:49:57 +0000 (11:49 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Mar 2025 11:19:39 +0000 (12:19 +0100)
commit87e5d6228425a3fef3de270acf485b550a9f42e0
treef56721c1f4879e4324edcd14df953ddb1b6ddef5
parent3c4668aff41c6cddb4ad3ef318d9582c16068ee0
more: fix repeat command

The function more_key_command() may modify the current command setting.
We need to remember the original unmodified version, as specified by
the user, as the previous command; otherwise, the output will be affected
by unexpected cmd.number settings.

Simple reproducer:

 $ more -c /etc/passwd

 - Press <enter> to jump to the next line.
 - Press '.' to repeat the last command.

Old version:
 - It clears the screen and prints only one line (like the "1 <enter>" command).
Fixed version:
 - It jumps to the next line (like the "<enter>" command).

Reported-by: Benno Schulenberg <bensberg@telfort.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 5be4bdf81a8e89b98b12db275deb6154f87feb4b)
text-utils/more.c