diff --git a/src/MRC.lua b/src/MRC.lua index 8ebacff9d..ea7794f31 100644 --- a/src/MRC.lua +++ b/src/MRC.lua @@ -597,11 +597,16 @@ end local function l_check_user_groups(resultT) local usrFlg = resultT.userT and resultT.userT[myConfig("username")] local grpFlg = resultT.groupT and l_intersection(myConfig("usergroups"),resultT.groupT) - local nUsrFlg = resultT.notuserT and resultT.notuserT[myConfig("username")] - local nGrpFlg = resultT.notgroupT and l_intersection(myConfig("usergroups"),resultT.notgroupT) + local nUsrFlg = resultT.notUserT and resultT.notUserT[myConfig("username")] + local nGrpFlg = resultT.notGroupT and l_intersection(myConfig("usergroups"),resultT.notGroupT) - local flag = (usrFlg or grpFlg) or (not (resultT.userT or resultT.groupT) and + local flag = (usrFlg or grpFlg) or (not (resultT.userT or resultT.groupT) and not (nUsrFlg or nGrpFlg)) + + --dbg.print{"l_check_user_groups: usrFlg: ",usrFlg,", nUsrFlg: ",nUsrFlg,"\n"} + --dbg.print{" flag: ",flag,"\n"} + + return flag end @@ -633,9 +638,10 @@ local function l_check_hidden_modifiers(fullName, resultT, visibleT, show_hidden local hide_active = (l_check_time_range(resultT, 0) == "inRange" and l_check_user_groups(resultT)) + if (not hide_active) then - -- isVisible, hidden_loaded, kind, count dbg.fini("l_check_hidden_modifiers") + -- isVisible, hidden_loaded, kind, count return true, false, "normal", true end local isVisible @@ -647,8 +653,8 @@ local function l_check_hidden_modifiers(fullName, resultT, visibleT, show_hidden end - dbg.print{"fullName: ",fullName,", resultT.kind: ", resultT.kind, ", count: ",count,"\n"} - dbg.fini("l_check_hidden_modifiers") + --dbg.print{"fullName: ",fullName,", resultT.kind: ", resultT.kind, ", count: ",count,"\n"} + --dbg.fini("l_check_hidden_modifiers") return isVisible, resultT.hidden_loaded, resultT.kind, count end @@ -677,10 +683,12 @@ function M.isVisible(self, modT) -- hidden_loaded = true|nil, } -- if hidden. - + ------------------------------------------------------------ -- If sn is already in the ModuleTable then use MT data instead + dbg.print{"fullName: ",fullName,"\n"} + if (mt:exists(sn,fullName)) then local moduleKindT = mt:moduleKindT(sn) if (not moduleKindT) then @@ -690,12 +698,12 @@ function M.isVisible(self, modT) end --dbg.print{"fullName: ",fullName,"\n"} --dbg.printT("mt:exists(sn): true, my_resultT",my_resultT) - dbg.fini("MRC:isVisible") + dbg.fini("(1) MRC:isVisible") return my_resultT end - local resultT = l_findHiddenState(self, mpathA, sn, fullName, fn) + local resultT = l_findHiddenState(self, mpathA, sn, fullName, fn) if (type(resultT) == "table" ) then --dbg.printT("from hidden State resultT",resultT) isVisible, hidden_loaded, kind, count = l_check_hidden_modifiers(fullName, resultT, visibleT, show_hidden) @@ -707,7 +715,7 @@ function M.isVisible(self, modT) local idx = fullName:find("/%.") isVisible = (idx == nil) or (visibleT.hidden == true) or show_hidden kind = (idx == nil) and "normal" or "hidden" - count = show_hidden or (idx == nil) + count = show_hidden or (idx == nil) end modT.isVisible = isVisible @@ -718,12 +726,12 @@ function M.isVisible(self, modT) hook.apply("isVisibleHook", modT) my_resultT = { isVisible = modT.isVisible, - moduleKindT = {kind=modT.kind, hidden_loaded = modT.hidden_loaded}, + moduleKindT = {kind=modT.kind, hidden_loaded = modT.hidden_loaded}, count = count } - + --dbg.print{"fullName: ",fullName,", isVisible: ",isVisible,", kind: ",kind,", show_hidden: ", show_hidden,", count: ",count,", hidden_loaded: ",hidden_loaded,"\n"} --dbg.printT("my_resultT",my_resultT) - dbg.fini("MRC:isVisible") + dbg.fini("(2) MRC:isVisible") return my_resultT end @@ -736,7 +744,7 @@ function M.isForbidden(self, modT) local fullName = modT.fullName local fn = modT.fn local sn = modT.sn - local resultT = l_findForbiddenState(self, mpathA, sn, fullName, fn) + local resultT = l_findForbiddenState(self, mpathA, sn, fullName, fn) --dbg.print{"fullName: ",fullName,"\n"} --dbg.printT("resultT",resultT) @@ -745,7 +753,7 @@ function M.isForbidden(self, modT) --dbg.fini("MRC:isForbidden") return nil end - + local forbiddenState = l_check_forbidden_modifiers(fullName, resultT) modT.forbiddenState = forbiddenState @@ -790,7 +798,7 @@ function M.find_wght_for_fullName(self, fullName, wV) dbg.fini("MRC:find_wght_for_fullName: no fullName") return wV end - + -- split fullName into an array on '/' --> fnA local fnA = {} @@ -821,7 +829,7 @@ function M.find_wght_for_fullName(self, fullName, wV) return wV end - local weight = t.weight + local weight = t.weight local idx = wV:match("^.*()/") if (weight) then if (idx) then @@ -830,7 +838,7 @@ function M.find_wght_for_fullName(self, fullName, wV) wV = weight .. wV:sub(2,-1) end end - + dbg.print{"found weight: ",weight,", wV: ",wV,"\n"} dbg.fini("MRC:find_wght_for_fullName") return wV