Scripting Bugs

Things you’d like to miss in the future...
Forum rules
When reporting a bug, please include the following information: your XYplorer version (e.g., v27.90.0047), your Windows version (e.g., Win 11), and your screen scaling percentage (e.g., 125%). We recommend adding your Windows version and screen scaling percentage to your profile or signature. This will make debugging much easier for us.
admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

Agreed, I make it 1/0.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

Much improved in 13.70.0126.

Sad part is I rewrote that part of the script and no longer need IsUnicode.
Oh well! :whistle:

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

So your script will also run with older versions of XY. With IsUnicode it probably would not... :whistle:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

admin wrote:So your script will also run with older versions of XY. With IsUnicode it probably would not... :whistle:
I'm not sure how far back it can support currently.

Given that IsUnicode returned the localized strings, if I cared about backwards compatibility and still needed IsUnicode surrounding it in Eval wouldn't have worked anyhow. I guess I would have had to do something like:

Code: Select all

"Test"
 $IS_UNICODE_FALSE = IsUnicode('a');

 $tests = 'abc|€|';
 $results = '';
 foreach ($test, $tests, '|') {
    $verdict = (IsUnicode($test) != $IS_UNICODE_FALSE) ? 'is' : 'is not';
    $results = $results . "'$test' $verdict unicode.<crlf>";
 }
 Text $results;

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

Yes, clever!

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

I always thought that Get('curitem') and its variable version <get curitem> were equivalent to <curitem>, but this doesn't seem to be true.

In a fresh XY:

Code: Select all

::goto "<xy>";$f = "<focitem>";Sel '-1';SelectItems $f, 2, 0;Echo "Variable: <curitem><crlf>Get: <get curitem>";
This might just need clarifying in help but it smells like a :bug: to me... :?

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

I'd say :bug: . Next version both will show "".

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

Ahem, no. That fix was not good. Actually both variables are NOT the same.

Code: Select all

    > FYI, <get curitem> is not the same as <curitem>:
      - <curitem> = the currently selected and focused item.
      - <get curitem> = the currently selected and focused item, or of there is 
        none the previously selected and focused item.

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Scripting Bugs

Post by LittleBiG »

And probably this fix messed up the comparing.

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

Yep.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

admin wrote:Ahem, no. That fix was not good. Actually both variables are NOT the same.

Code: Select all

    > FYI, <get curitem> is not the same as <curitem>:
      - <curitem> = the currently selected and focused item.
      - <get curitem> = the currently selected and focused item, or of there is 
        none the previously selected and focused item.
It's confusing but perfectly fine for them to be different.

"Note: This differs from the native variable <curitem> in that it will return the previously selected and focused item if the currently focused item is not selected."

Something like that under the 'curitem' section of the Get SC is more than enough.

Code: Select all

::help('idh_scripting_comref.htm#idh_sc_get');

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

Thanks, done.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

PopupMenu's count parameter only treats omitting it as -1.

Code: Select all

"Menu of omission." Text PopupMenu("a|-|b|c",,,,); // Correct. Menu is shown.
"Menu of empty." Text PopupMenu("a|-|b|c",,,,''); // ?... Menu is not shown.
"Menu of 1" Text PopupMenu("a|-|b|c",,,,1); // Correct. Menu of just 'a' is shown.
"Menu of 0" Text PopupMenu("a|-|b|c",,,,0); // Correct. No menu is shown.
"Menu of All" Text PopupMenu("a|-|b|c",,,,-1); // Incorrect. No menu is shown.
"Menu of All (Quoted)" Text PopupMenu("a|-|b|c",,,,"-1"); // Incorrect. No menu is shown.
"Menu of All (Var)" $count = -1;Text PopupMenu("a|-|b|c",,,,$count); // Incorrect. No menu is shown.

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Bugs

Post by admin »

Yep, fix comes.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

Self and Caller enter a fugue state when Load displays a menu for multiple labels...

Code: Select all

"A" Text "Myself:<crlf>" . Self('script') . "<crlf 2>Caller:<crlf>" . Caller('script');
"B" Text "Myself:<crlf>" . Self('caption') . "<crlf 2>Caller:<crlf>" . Caller('caption');
-
"Sub - Correct" Sub 'A'; Sub 'B';
"Load A - Correct" Load '*', 'A';
"Load B - Correct" Load '*', 'B';
-
"Load A;B - Confused" Load '*', 'A;B';

Post Reply