[PATCH 2/6] scriptreplay: make Up/Down keys use a percentage instead of fixed amount

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Using a fixed 0.1 amount made each subsequent Down-arrow key slow things
down _more_, and each subsequent Up-arrow key speed things up _less_.
It's nicer when each subsequent keystroke has the same relative effect.

Signed-off-by: Benno Schulenberg <[email protected]>
---
 term-utils/scriptreplay.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
index 0e1444ca1..5751e1b52 100644
--- a/term-utils/scriptreplay.c
+++ b/term-utils/scriptreplay.c
@@ -76,8 +76,8 @@ usage(void)
 	fputs(USAGE_SEPARATOR, out);
 	fputs(_("Key bindings:\n"), out);
 	fputs(_(" space        toggles between pause and play\n"), out);
-	fputs(_(" up-arrow     increases the time divisor with 0.1\n"), out);
-	fputs(_(" down-arrow   decreases the time divisor with 0.1\n"), out);
+	fputs(_(" up-arrow     increases playback speed with ten percent\n"), out);
+	fputs(_(" down-arrow   decreases playback speed with ten percent\n"), out);
 
 	fprintf(out, USAGE_MAN_TAIL("scriptreplay(1)"));
 	exit(EXIT_SUCCESS);
@@ -343,10 +343,10 @@ main(int argc, char *argv[])
 			if (ch == '[') {
 				ch = fgetc(stdin);
 				if (ch == 'A') { /* Up arrow */
-					divi += 0.1;
+					divi *= 1.1;
 					replay_set_delay_div(setup, divi);
 				} else if (ch == 'B') { /* Down arrow */
-					divi -= 0.1;
+					divi *= 0.9;
 					if (divi < 0.1)
 						divi = 0.1;
 					replay_set_delay_div(setup, divi);
-- 
2.48.1
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.