This crops up whenever you just switched from tab # N+1 to tab # N and close current tab. unmanage() first decreases lastsel (so it becomes N) then erroneously tests it against sel and focuses first tab instead. One can see that focus() would never set lastsel == sel, so I took liberty to fix this annoying behaviour which happens to frequently with newposition = 0 and npisrelative = True settings. --- tabbed.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tabbed.c b/tabbed.c index ba1df21..9ece904 100644 --- a/tabbed.c +++ b/tabbed.c @@ -1008,7 +1008,11 @@ unmanage(int c) { } if(c == sel) { - if(lastsel > 0 && lastsel != sel) { + /* Note that focus() will never set lastsel == sel, + * so if here lastsel == sel, it was decreased by above if() clause + * and was actually (sel + 1) before. + */ + if(lastsel > 0) { focus(lastsel); } else { focus(0); -- 1.8.3.2