Introduction
Introduction Statistics Contact Development Disclaimer Help
movetab(): Move selected tab instead of switching - tabbed - tab interface for …
git clone git://git.suckless.org/tabbed
Log
Files
Refs
README
LICENSE
---
commit 829980f28aa91f4837e047bd9e3b599bf6d655a6
parent 5c560f3784971b1a3bbfc7d18af759778f7779d1
Author: Markus Teich <[email protected]>
Date: Tue, 7 Oct 2014 17:15:59 +0200
movetab(): Move selected tab instead of switching
Before this patch, movetab() just switched positions of the selected tab with
the new position. This resulted in unexpected behaviour when „moving“ a tab…
one end of the list.
Now tabs are moved correctly by the specified amount of indizes.
Signed-off-by: Christoph Lohmann <[email protected]>
Diffstat:
M tabbed.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/tabbed.c b/tabbed.c
@@ -795,19 +795,19 @@ movetab(const Arg *arg) {
int c;
Client *new;
- if(sel < 0 || (arg->i == 0))
- return;
-
- c = sel + arg->i;
- while(c >= nclients)
- c -= nclients;
- while(c < 0)
+ c = (sel + arg->i) % nclients;
+ if(c < 0)
c += nclients;
- new = clients[c];
- clients[c] = clients[sel];
- clients[sel] = new;
+ if(sel < 0 || (c == sel))
+ return;
+ new = clients[sel];
+ if(sel < c)
+ memmove(&clients[sel], &clients[sel+1], sizeof(Client *) * (c …
+ else
+ memmove(&clients[c+1], &clients[c], sizeof(Client *) * (sel - …
+ clients[c] = new;
sel = c;
drawbar();
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.