[wiki] [sites] [tabbed][patch][move-clamped] accept out-of-bounds tab numbers || Michael Hendricks

From: <git_AT_suckless.org>
Date: Mon, 04 Apr 2022 17:56:53 +0200

commit 99dab1dc213266a9b6275090346512830fa064a7
Author: Michael Hendricks <michael_AT_ndrix.org>
Date: Mon Apr 4 09:56:05 2022 -0600

    [tabbed][patch][move-clamped] accept out-of-bounds tab numbers

diff --git a/tools.suckless.org/tabbed/patches/move-clamped/index.md b/tools.suckless.org/tabbed/patches/move-clamped/index.md
new file mode 100644
index 00000000..23f06740
--- /dev/null
+++ b/tools.suckless.org/tabbed/patches/move-clamped/index.md
_AT_@ -0,0 +1,13 @@
+Clamped move
+=============
+With this patch, tabbed interprets large position numbers as the
+largest known position. This allows `Ctrl-9`, for example, to always
+select the rightmost tab, even if there are only 4 tabs.
+
+Download
+--------
+* [tabbed-move-clamped-20200404-e2ca5f9.diff](tabbed-move-clamped-20200404-e2ca5f9.diff)
+
+Author
+------
+* Michael Hendricks <michael_AT_ndrix.org>
diff --git a/tools.suckless.org/tabbed/patches/move-clamped/tabbed-move-clamped-20200404-e2ca5f9.diff b/tools.suckless.org/tabbed/patches/move-clamped/tabbed-move-clamped-20200404-e2ca5f9.diff
new file mode 100644
index 00000000..b62f0e93
--- /dev/null
+++ b/tools.suckless.org/tabbed/patches/move-clamped/tabbed-move-clamped-20200404-e2ca5f9.diff
_AT_@ -0,0 +1,19 @@
+diff --git a/tabbed.c b/tabbed.c
+index eafe28a..e2ca5f9 100644
+--- a/tabbed.c
++++ b/tabbed.c
+_AT_@ -787,8 +787,12 @@ maprequest(const XEvent *e)
+ void
+ move(const Arg *arg)
+ {
+- if (arg->i >= 0 && arg->i < nclients)
+- focus(arg->i);
++ int i;
++
++ i = arg->i < nclients ? arg->i : nclients - 1;
++
++ if (i >= 0)
++ focus(i);
+ }
+
+ void
Received on Mon Apr 04 2022 - 17:56:53 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 04 2022 - 18:00:53 CEST