Script editor oddity Update

dunbarx at aol.com dunbarx at aol.com
Fri Apr 19 09:25:20 EDT 2013


The second part of my post no longer seems odd. Ignore it. But the first part is a puzzler.


Craig Newman



-----Original Message-----
From: dunbarx <dunbarx at aol.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Fri, Apr 19, 2013 9:22 am
Subject: Script editor oddity




>From the forum...


Yipes. Confirmed here. I never saw this before. I wonder if it happens in 
Hypercard.


Given a field with some text in it and a button with:


on mouseUp
   select after char 3 of fld 1
   put "xx" after the selectedChunk
end mouseUp


If you put a breakpoint in, say, the "select..." line, you will get "put "xx" 
after the selectedChunkxx" after you step through.


Running the script works as advertised. 


EDIT:


In HyperCard, stepping through puts the text in the field, not in the script 
editor line.


Craig Newman
 
--------------------------------------------------------


Well, this may not be a trivial thing.


Again, make a field with some text in it, and a button with:


on mouseUp
   select after char 3 of fld 1
   get the selectedchunk
   
   put "XX" after it
   do "put XX after" &&  it
end mouseUp


Run, (do not step) through,with the following:


1- Comment out the "do" line, and nothing happens.
2- Comment out the "put" line, and the "xx" is inserted correctly in the field.
3- Comment nothing, and an error is thrown, because the variable "it" now 
contains the chunk reference, but with "XX" appended:


char 4 to 3 of field 1XX


Now you will debug, the offending line being the "do" line. The code in the 
script editor has been modified when this sequence runs. The variable "it" has 
had the "XX" appended to it, just as it did when the earlier code was stepped 
through (though not when it was run), and the "do" line therefore breaks.


How has this not popped up before?


Craig Newman

 
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list