Bug #24209
Updated by Simon Schaufelberger about 2 years ago
HMENU provides three registers: count_menuItems, count_HMENU_MENUOBJ and count_MENUOBJ. count_menuItems is meant to provide the number of items in the current menu. count_HMENU_MENUOBJ is meant to provide the current number of a menu item with regards to the whole HMENU. count_MENUOBJ does the same but for inside the current menu. count_MENUOBJ is not properly initialized on each menu/submenu and thus contains the same value as count_HMENU_MENUOBJ. The solution is to reset count_MENUOBJ properly, taking into account that one must not loose the count of the current menu when "coming back" from a submenu. The following TS can be used to test the issue: <pre> lib.someMenu = HMENU lib.someMenu { 1 = TMENU 1 { expAll = 1 wrap = <ul>|</ul> NO { wrapItemAndSub.cObject = TEXT wrapItemAndSub.cObject.value = -| wrapItemAndSub.cObject.noTrimWrap = |<li> ({register:count_menuItems} - {register:count_HMENU_MENUOBJ} - {register:count_MENUOBJ}) |</li>| wrapItemAndSub.cObject.insertData = 1 } } 2 < .1 2.NO.wrapItemAndSub.cObject.value = --| 3 < .1 3.NO.wrapItemAndSub.cObject.value = ---| } </pre> It will show all the above-mentioned register. count_MENUOBJ is the last one. Observe how it has the same value as count_HMENU_MENUOBJ. Apply the patch and check again. Now count_MENUOBJ is incremented per menu. (issue imported from #M16573)