Page 1 of 1

[No bug, no wish!] Possible BUG with PopupNested

Posted: 02 Mar 2017 13:32
by PeterH
You might call this a :bug: , or you might call it "works as intended".
(In the second case this is a wish :-) )

I want a separator line ("-") on a not-first level of PopupNested. Example:

Code: Select all

   $menu = <<<#>>>
111
  222
    aaa
    bbb
-
    ccc
    ddd
  333
    eee
    fff
    -
    ggg
    hhh
#>>>;
   $sel	= PopUpNested($menu);
   Echo "sel = '$sel'.";
The left aligned "-" doesn't work correct, and (here) leads to some garbage in result. The second *aligned* "-" works as intended.
(At least the garbage looks like a :bug: .)

I'd expect (or wish) the first version to work as the second does.

To say: if you have more levels of indentation, and several groups of lines being packed together (part of them being generated), it can be a bit complicated to correctly indent the "-".
(And for me: it also looks better being just on the very left side.)

So, if possible: please handle a pur token "-" (without indentation) just as if it were indented.
That is: "-" would mean "separator line here".

Re: Possible BUG with PopupNested

Posted: 04 Mar 2017 11:02
by admin
I disagree. This is far from being a bug. I think it looks wrong and it is wrong. I also don't see why it should be a problem to indent it correctly. :?

Re: Possible BUG with PopupNested

Posted: 04 Mar 2017 11:52
by PeterH
OK, see it from another side: what else could a left aligned "-" mean, if not just a separator line?
At least this would give more sense than what's happening now. (Or do I miss something?)

The difference for me is that from the next 2 lines:

Code: Select all

// If ($levels == '-') {Return "-<crlf>";}      // oh - must be aligned! So...
   If ($levels == '-') {Return StrRepeat($tab, GetToken($lvls, 'count', '|')) . "-<crlf>";}

Re: Possible BUG with PopupNested

Posted: 04 Mar 2017 12:07
by admin
Well, I do this all day long. It's called coding. :)

Re: Possible BUG with PopupNested

Posted: 04 Mar 2017 12:39
by PeterH
OK: I'm convinced.
Not by your statement, but by what I've missed :mrgreen:

In the following coding the two - in front of 333 show situations, where different indentation of - makes a difference. (Though the first - only has limited sense :titter: )

Code: Select all

   $menu = <<<#>>>
111
  222
    aaa
    bbb
    -
    ccc
    ddd
    -
  -
  333
    eee
    fff
    -
    ggg
    hhh
#>>>;
   $sel   = PopUpNested($menu);
   Echo "sel = '$sel'.";
So it's more risk to make it wrong, but more levels to differentiate.

Thanks for all :appl:

Re: Possible BUG with PopupNested

Posted: 04 Mar 2017 12:57
by admin
I wanted you to see it yourself. ;) :P