Bug #24209
closedRegister count_MENUOBJ is not properly initialized
0%
Description
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:
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 = ---| }
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)
Files
Updated by Francois Suter over 13 years ago
Note: the behavior of count_HMENU_MENUOBJ is rather weird (it is increased properly but contains surprising values), but that would be a separate RFC.
Updated by Francois Suter over 13 years ago
Committed to 4.3 (revision 9648), 4.4 (revision 9649) and trunk (revision 9650)
Updated by Simon Schaufelberger about 2 years ago
- Description updated (diff)
- Category deleted (
Communication) - Target version deleted (
0)