[dev] [tabbed] [PATCH] Fixed obscure miscalculation when a client is closed.

From: Alexander Sedov <alex0player_AT_gmail.com>
Date: Mon, 29 Jul 2013 11:11:33 +0400

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
_AT_@ -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
Received on Mon Jul 29 2013 - 09:11:33 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 29 2013 - 09:24:02 CEST