Page 1 of 1

A debugger too obedient

Posted: Mon Jun 13, 2016 12:34 am
by Fermin
Lets suppose I have a list field with multiple lines, p. eg.

RINGO
GEORGE
JOHN
PAUL

And his his script is:

on mouseup
    put the selectedtext into theSel
end mouseup

Well. Now, to check its operation, I put a breakpoint at the beginning of the code (on mouse up)

If I go to the field and click, p. eg. the second line, the debugguer is activated and when it reaches the end (end mouseUp), the variable theSel does not show 'GEORGE' as is expected.
What it shows is: "put the selectedtext into theSel".

Curious! I guess it's because the LiveCode debugguer had just select this line as a visual aid for monitoring debug.

Re: A debugger too obedient

Posted: Mon Jun 13, 2016 12:52 am
by bn
Hi Fermin,

if you code

Code: Select all

put the selectedtext of me into theSel
then the debugger shows "George".

The unspecified selectedText is any selectedText at the moment. In this special case line 2 of the ScriptEditor

you can see the difference when you step through this code

Code: Select all

on mouseup
   put the selectedText of me into tRealSelection
   put the selectedtext into theSel
   put the selectedText into tCurrentSelection
end mouseup
I would not think it is a bug because that is the way selectedText works. Others may differ on this.

Kind regards
Bernd

Re: A debugger too obedient

Posted: Mon Jun 13, 2016 8:48 am
by Fermin
Thank you, Bernd. Now I see it's not a bug, but the correct way the debugger works .
The words "of me" are key.

Re: A debugger too obedient

Posted: Mon Jun 13, 2016 3:18 pm
by dunbarx
You have to remember that all IDE elements are simply ordinary stacks. If the debugger has focus, it may insinuate itself into your (ongoing?) processes. I got caught in this way just recently, and also thought it was a bug.

Craig Newman