Hi,
I found a bug, <george> from #tcl on IRC.freenode.net
helped me understand the problem and I'm filling a bug
report so it can stay in the archives.
The bug is reproduced on the 8.4 versions (tested on 8.
4.11 and 8.4.12), but seems to be fixed in the cvs HEAD
of tk (as of date March 30th, 2006).
If a text widget has elided text in it, then a search
will fail in some cases. To be more precise, if we have
X chars elided in a text, and we do a search after
these chars, then the offset by which the search should
begin is X chars off. In other words, if the string
"test" is located at 1.10 in the widget and we have at
least 1 char elided in the range 1.0 to 1.9. the search
for "test" will fail if the start position of the
search is 1.10, it will work for 1.9 if we had only 1
char elided, if we have 3 chars elided in the range 1.0
to 1.9, then the search will fail for start index 1.10,
1.9, 1.8, and it will succeed at 1.7.
Here's an execution trace :
(bin) 1 % pack [text .t]
(bin) 2 % .t tag configure el -elide true
(bin) 3 % .t insert end hello
(bin) 4 % .t insert end world el
(bin) 5 % .t insert end worldtest
(bin) 6 % .t get 1.0 end
helloworldworldtest
(bin) 7 % .t search test 1.0 end
1.15
(bin) 8 % .t search test 1.15 end
(bin) 9 % .t search test 1.11 end
(bin) 10 % .t search test 1.10 end
1.15
Please note that in this case, we need to add 'end' as
the last index to search for, if not, for this example,
the search will work, but that's only because the
search gets wrapped to the beginning of the widget. If
we had a lot of lines in the widget, we could have done
for example a [.t search test 22.15] and it would have
returned '1.15' instead of '22.15'
p.s.: it seems that if I do [.t search test 1.15 end]
it returns the right answer. In my case, it's not
acceptable because I really want to skip elided text,
I'll manage a workaround.
Thanks,
KaKaRoTo
Logged In: YES
user_id=1000954
soall you need to do, is make sure that everytime we have a
match, change the $start variable, so we'll have :
search -elide $symbol 1.0 end
found match at 1.1
make 1.1 to 1.3 elided
search -elide $symbol 1.1+1c end
found match at 1.5 ...
Logged In: YES
user_id=1000954
Ignore that comment - i accidentally pasted on the wrong
tab... :$ sorry
Logged In: YES
user_id=686750
lol, please ignore vivia's followup, it seems she (once
again) wrote in the wrong place.. the message was supposed
to go in aMSN's task tracker and it's supposed to be the
workaround to fix the bug we have with aMSN and tk 8.4 and
this exact problem : doing a search with -elide, and start
the search for the last found position +1c (+check tag names
for the match indices and make sure none of them are elided
..)
KaKaRoTo
Logged In: YES
user_id=32170
Sorry Jeff, but cvs HEAD has had so many changes/improvements in the areas of
'elide' handling and text searching (and everything else to do with the text
widget) that I wouldn't know where to start fixing this in tk 8.4. 8.4's handling
of elide is fairly simplistic and this is just one of many, many problems. So, I
would say this is a "won't fix".
Vince.
Logged In: YES
user_id=72656
This is a won't fix for 8.4 then.