Bug#231826: Is #231826 really a bug in menu?

2005-09-26 Thread Bill Allombert
On Thu, Apr 14, 2005 at 11:34:40PM +0200, Bill Allombert wrote:
 On Wed, Apr 13, 2005 at 11:45:42AM +0200, Bill Allombert wrote:
  On Wed, Apr 13, 2005 at 02:47:32AM +0200, Daniel Brockman wrote:
   Bill, can you verify that this is a bug in menu itself,
   rather than in ratmenu's application of menu?
   
   If not, do you think you could help fix the ratmenu script?
   I've tried to understand the menu language with little avail,
   and it seems Jonathan cannot find any error in the script.
 
 Hello Morten,
 
 I more than suspect that the three install-menu functions 
 entryindex(), firstentry() and lastentry() do not work, 
 and that cause that bug.
 
 Add entryindex() in the start function in the fvwm menu-methods,
 like that:
 function start($var,$com)=\
 + \ entryindex()   escfirst(title(),$hotkey,) \
 cond_surr(icon(),%,%) \  $var   $com \n
 
 rerun menu, we get a ~/.fvwm/menudefs.hook file with menu like:
 ...
 AddToMenu /Debian/Apps/Games/Card Card Title Top
 + 12 aBridge Exec exec /usr/bin/abridge
 + 0 Canfield /home/bill
  x-terminal-emulator  -T Canfield -e /usr/games/canfield
 + 2 Cribbage /home/bill
  x-terminal-emulator  -T Cribbage -e /usr/games/cribbage
 + 4 Floater%/usr/share/pixmaps/floater-24.xpm% Exec exec /usr/games/floater
 + 6 Go Fish /home/bill
  x-terminal-emulator  -T Go Fish -e sh -c '/usr/games/fish;echo;echo PRESS 
 ENT+ 8 Mille Bornes /home/bill
  x-terminal-emulator  -T Mille Bornes -e /usr/games/mille
 + 10 Xpatience2 Exec exec /usr/games/xpat2
 
 There is 3 problems:
 1) 0 is not the first entry, that break firstentry().
 2) The numbers are all even.
 3) They are not sorted.

OK, so apparently the index is computed in menuentry::postprocess()
before the menu is sorted, that is why aBridge is first.
(It is last in ASCII order, but first after ucfirst()).

Here a patch that should fix the issue. Sorry it took so long...

Morten, could you check if I follow the C++ usage ?

Cheers,
-- 
Bill. [EMAIL PROTECTED]

Imagine a large red swirl here. 


--- menu-2.1.25/install-menu/menu-tree.cc   2004-09-26 11:38:00.0 
+0200
+++ menu-2.1.26/install-menu/menu-tree.cc   2005-09-24 22:32:05.0 
+0200
@@ -254,6 +254,9 @@
 
 sorted.insert(std::pairstring, menuentry *(s, sub_i-second));
   }
+  int index = 0;
+  for (i = sorted.begin(); i != sorted.end(); ++i)
+i-second-vars[PRIVATE_ENTRYINDEX_VAR] = itostring(index++);
 
   // Output the menu according to the treewalk variable.
   for (string::size_type j = 0; j  treew.length(); ++j)
@@ -432,7 +435,6 @@
 void menuentry::postprocess(int n_parent, int level, const std::string 
prev_section)
 {
   submenu_container::iterator i, i_next;
-  int index = 0;
 
   vars[PRIVATE_LEVEL_VAR] = itostring(level);
 
@@ -440,7 +442,7 @@
   if (!level)
   vars[SECTION_VAR] = prev_section;
 
-  for (i = submenus.begin(); i != submenus.end(); ++index)
+  for (i = submenus.begin(); i != submenus.end();)
   {
 i_next=i;
 i_next++;
@@ -456,8 +458,6 @@
 // is useful when for example the title is Foo version/456.
 me-vars[BASESECTION_VAR] = newsection.substr(0, 
newsection.rfind(me-vars[TITLE_VAR]) - 1);
 
-me-vars[PRIVATE_ENTRYINDEX_VAR] = itostring(index);
-
 if (!me-submenus.empty())
 me-postprocess(submenus.size(), level+1, newsection);
 
@@ -468,7 +468,6 @@
 // This is an empty menu (without comand or submenus), so delete it.
 submenus.erase(i);
 
-index--;
   } else {
 i-second-vars[PRIVATE_ENTRYCOUNT_VAR] = itostring(submenus.size());
 i-second-vars[PRIVATE_LEVEL_VAR] = itostring(level+1);
@@ -476,7 +475,6 @@
 }
 // don't use i here any more, it may have been erased above
 i = i_next; // don't do i++, as *i now may not be defined
-index++;
   }
 
   generate_hotkeys();


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#231826: Is #231826 really a bug in menu?

2005-04-14 Thread Bill Allombert
On Wed, Apr 13, 2005 at 11:45:42AM +0200, Bill Allombert wrote:
 On Wed, Apr 13, 2005 at 02:47:32AM +0200, Daniel Brockman wrote:
  Bill, can you verify that this is a bug in menu itself,
  rather than in ratmenu's application of menu?
  
  If not, do you think you could help fix the ratmenu script?
  I've tried to understand the menu language with little avail,
  and it seems Jonathan cannot find any error in the script.

Hello Morten,

I more than suspect that the three install-menu functions 
entryindex(), firstentry() and lastentry() do not work, 
and that cause that bug.

Add entryindex() in the start function in the fvwm menu-methods,
like that:
function start($var,$com)=\
+ \ entryindex()   escfirst(title(),$hotkey,) \
cond_surr(icon(),%,%) \  $var   $com \n

rerun menu, we get a ~/.fvwm/menudefs.hook file with menu like:
...
AddToMenu /Debian/Apps/Games/Card Card Title Top
+ 12 aBridge Exec exec /usr/bin/abridge
+ 0 Canfield /home/bill
 x-terminal-emulator  -T Canfield -e /usr/games/canfield
+ 2 Cribbage /home/bill
 x-terminal-emulator  -T Cribbage -e /usr/games/cribbage
+ 4 Floater%/usr/share/pixmaps/floater-24.xpm% Exec exec /usr/games/floater
+ 6 Go Fish /home/bill
 x-terminal-emulator  -T Go Fish -e sh -c '/usr/games/fish;echo;echo PRESS 
ENT+ 8 Mille Bornes /home/bill
 x-terminal-emulator  -T Mille Bornes -e /usr/games/mille
+ 10 Xpatience2 Exec exec /usr/games/xpat2

There is 3 problems:
1) 0 is not the first entry, that break firstentry().
2) The numbers are all even.
3) They are not sorted.

Do you know if it is possible to fix this bug?

Cheers,
--
Bill. [EMAIL PROTECTED]

Imagine a large red swirl here. 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#231826: Is #231826 really a bug in menu?

2005-04-13 Thread Bill Allombert
On Wed, Apr 13, 2005 at 02:47:32AM +0200, Daniel Brockman wrote:
 Bill, can you verify that this is a bug in menu itself,
 rather than in ratmenu's application of menu?
 
 If not, do you think you could help fix the ratmenu script?
 I've tried to understand the menu language with little avail,
 and it seems Jonathan cannot find any error in the script.

Neither can I. It looks like an awful race condition inside install-menu
but I am not sure. I need to investigate.

 As it is, this bug is rendering ratmenu pretty useless.

No way to change ratmenu to use a simpler menu format ?

Cheers,
-- 
Bill. [EMAIL PROTECTED]

Imagine a large red swirl here. 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#231826: Is #231826 really a bug in menu?

2005-04-12 Thread Daniel Brockman
Bill, can you verify that this is a bug in menu itself,
rather than in ratmenu's application of menu?

If not, do you think you could help fix the ratmenu script?
I've tried to understand the menu language with little avail,
and it seems Jonathan cannot find any error in the script.

As it is, this bug is rendering ratmenu pretty useless.

Thanks,

-- 
Daniel Brockman [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]