Failing to understand the oddities of the "line" chunk

Peter M. Brigham, MD pmbrig at
Tue Mar 20 09:40:24 EDT 2012

On Mar 20, 2012, at 1:52 AM, Geoff Canyon wrote:

> On Mon, Mar 19, 2012 at 12:54 PM, J. Landman Gay
> <jacque at>wrote:
>> I think it should behave the same way character selections do. A negative
>> range has been a valid construct since HyperCard and is, actually, the only
>> way to set the insertion point by script. It's a necessary feature.
> This seems to work, and is far clearer:
>   *select* before char 8 of fld 1
> "after" works as well, as do word and line references.

Right, but if you have an insertion point in a field (no text selected), then "the selectedChunk" will contain something like
   char 13 to 12 of field 2
This is designed so that the selectedChunk is always in the form
   char <startchar> to <endchar> of fld <fldNbr>
That's just the way it works. After dealing with chunks for a while it does make sense, and it's consistent.

Jacque's point still holds, though -- the implementation of this form using lines instead of chars is *not* consistent.

try this:

put "one,two,three" into t
replace comma with cr in t
put t into tt
put "WHAT!!!???" into line 3 to 2 of tt
put t & cr & cr & tt

which gives you:



The "WHAT" should appear at the start of line 3, or possibly should replace the cr at the end of line 2, depending on how you look at it.

I agree with you that this syntax should be blocked by the IDE at compile time if it's not going to be implemented properly at runtime. I'd call it a bug.

-- Peter

Peter M. Brigham
pmbrig at

More information about the Use-livecode mailing list