]> 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 10:49:57 +0000 (11:49 +0100)
commit5be4bdf81a8e89b98b12db275deb6154f87feb4b
treea657f0b2c84f2cb27ad961f39720683f85f84e61
parent7dd72369680323a1c01dd7226e1158741cc8d55d
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>
text-utils/more.c