From a16413f96c8db7d085591aafa431a8622a6e8324 Mon Sep 17 00:00:00 2001
From: rubenwardy <rubenwardy@gmail.com>
Date: Sun, 5 Mar 2017 12:37:05 +0000
Subject: [PATCH] sfinv: Fix wrong tab being highlighted

Thank you to @ForbiddenJ for finding cause of the issue.
---
 mods/sfinv/api.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mods/sfinv/api.lua b/mods/sfinv/api.lua
index b6e9766..ff6433b 100644
--- a/mods/sfinv/api.lua
+++ b/mods/sfinv/api.lua
@@ -70,7 +70,7 @@ function sfinv.get_formspec(player, context)
 			nav[#nav + 1] = pdef.title
 			nav_ids[#nav_ids + 1] = pdef.name
 			if pdef.name == context.page then
-				current_idx = i
+				current_idx = #nav_ids
 			end
 		end
 	end