.text search unexpected match



Hi,

I inadvertently found out that .text search with a stopIndex matches strings
that are not entirely included in the search area.

Consider the following simple script:

text .t
pack .t
..t insert 1.0 "Hello world!\n"
..t insert 2.0 "This is a test\n"
set match [.t search -- \
"world" 1.3 1.8]
puts $match

The search occurs between positions 1.3 and 1.8, i.e. the search area does
not include the full word "world" that is searched for.

Nevertheless, a match is found, which means that .t search does not check
whether the match it finds is entirely included in the search area or not.

Is this the intended behavior?

If yes, I have a problem because in my application .text search with
stopindex is used to search in a selection in a text widget. I can easily
extend the selection with the length of the string to search for, but this
works as long as I don't search for regexps. In this latter case, I have no
way to determine how long the match can be, therefore I'm stuck.

Thanks for any hint,
Francois


.