tmux(1): fix args_string_percentage error strings

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

tmux(1): fix args_string_percentage error strings

Kris Katterjohn-2
Hey,

In tmux(1) there are two error strings in args_string_percentage that
are backwards.  If taking a percentage yields a value that is too small
then an error string saying "too large" is used and vice versa.

One way to see an incorrect message is with

  display-popup -h 0%

which complains that the height is too large.

A small diff to fix this is below.

Cheers,
Kris Katterjohn

Index: usr.bin/tmux/arguments.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/arguments.c,v
retrieving revision 1.32
diff -u -p -r1.32 arguments.c
--- usr.bin/tmux/arguments.c 16 May 2020 15:40:04 -0000 1.32
+++ usr.bin/tmux/arguments.c 23 May 2020 22:15:01 -0000
@@ -407,11 +407,11 @@ args_string_percentage(const char *value
  }
  ll = (curval * ll) / 100;
  if (ll < minval) {
- *cause = xstrdup("too large");
+ *cause = xstrdup("too small");
  return (0);
  }
  if (ll > maxval) {
- *cause = xstrdup("too small");
+ *cause = xstrdup("too large");
  return (0);
  }
  } else {