Hi,
I've got what I think might be a better implementation of the
nextprevtag.c patch.
It's just a simple bitwise left/right circular shift of the tagset,
avoiding the loop that the older patch used and with the additional
benefit of working also for switching tagset with multiple tags
selected.
I did it before realizing there was already a "nextprevtag.c", and
although it's very simple, since it's a bit different in functionality
I thought that maybe it would be useful for someone else.
--
Fernando Carmona Varo
/** Function to shift the current view to the left/right
*
* @param: "arg->i" stores the number of tags to shift right (positive value)
* or left (negative value)
*/
void
shiftview(const Arg *arg) {
Arg shifted;
if(arg->i > 0) // left circular shift
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
else // right circular shift
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
view(&shifted);
}