you can find all the info you ever need in the tcl/tk man pages. For example : http://www.tcl.tk/man/tcl8.4/TkCmd/text.htm#M39
Yes, there is 'no' text that is elided apart from the one we specifically set to elided (the smileys). The reason for it is that, if you ever noticed, when you copy/paste text from the chat window, the smileys get copied too! and we do this by copying all text *including* the elided text. So when we find a smiley, we 'elide' that text (this way we can know what the original text was in case we want to copy that text some time), then we search again for the smiley in the text. If (because of that specific tk bug) the search does indeed include the elided text, it means we get an infinite loop which would be something like : set text "hello :) there" set symbol ":)" set pos [search $symbol $text] ; # returns position 6 tag elided .. ;# we set the symbol text to elided, so it disappears and we insert the emoticon set pos [search $symbol $text] ;# should not return anything, but with the bug it would return 6 ;# since we loop on the 'search', we would always get '6' as return value and we would get an infinite loop. Ok so that was the explanation for why I said infinite loop, but while writing this, I remembered the real issue, the real bug we had. In *SOME* Tk versions the [search] doesn't "include" elided text in its search, but it actually includes it in the position counting. In other words, for example, if we had : set text "hello :):) world" the first search returns position 6, so we elide that text (disappears) and we add an image. it means we now have : "hello X:) world :)" (where X is an image which also takes one character in the position counting) so if we search again for the second smiley, it should be at position 7, right ? yes, it is, but with some Tk versions, even if they do skip the elided text, the position they return is 9 (the 7th position + the 2 positions taken by the elided text), so if we try and replace that, it doesn't work. In other words, since some versions include the elided and some don't (and even the Tk team don't know when it happens, on which conditions, etc.. because it could happen and not happen with the same version, depending on the system or whatever), we HAD to do a search --elided to make sure we search EVEN the elided text to be sure we had one behavior not the other and more importantly not either one of the behaviors without knowing which one it is. So we search through all text, including elided, and we manually skip the ones that have the elided tag on them. I hope this was clear. I'm sure there were explanations in the commit log where this was added. Try a 'svn blame' command on the file to get the revision where the fix was added and you'll see if anything important is written there. If it's not clear enough tell me, but I'm not sure if I'm a good enough speaker.. KaKaRoTo On Tue, May 22, 2007 at 11:46:48PM +0200, Mirko Hansen wrote: > ah, thanks for the explanation of the elided thing. i'm slightly new to > tcl/tk and wondered what this exactly means. so i greped the source for > elide and it seems that there should be no elided text at all. tell me if > i'm wrong, but the only two things being elided are the smileys and the > play/stop for the voice clips. so in a normal chat message shouldn't be any > elided text. the other thing is, that outgoing messages don't have this > check, too. there should be no difference handling those two from the > textual point of view. > testing on tcl/tk 8.4.1 worked fine, no crash at all. but well ... why > infinite loop? i interpreted this piece of code as a protection agains > replacing (partly) elided text by a smiley. it only prevents replacing text > and doesn't change anything on the control variable of the loop, it > shouldn't result in an infinite loop at all. > > Greetings, > Mirko > > 2007/5/22, Youness Alaoui <[EMAIL PROTECTED]>: > > > >what about elided text ? elided is when text is 'hidden', smileys are not > >deleted and replaced by an > >image, they're hidden (elided) so if you don't check and make sure no > >elided text is being read, then > >it will go into infinite loop.. which tcl/tk versions did you test this on > >? try it on 8.4.1 for > >example and see if it works. > > > >KKRT > > > >On Mon, May 21, 2007 at 10:51:30PM +0200, Mirko Hansen wrote: > >> Another fix from me concerning smileys: Sometimes incoming emoticons, > >not > >> separated by a space, in special constellations, aren't replaced by the > >> image. This fix works fine for me, but I'm not sure whether this piece > >of > >> code is still needed. The comment on revision 6270 says it's a > >workaround > >> for a bug in Tk 8.4 on the search command, but on the outgoing part the > >same > >> piece of code has been removed because of errors. So I think this > >removal > >> should be ok, too. > >> > >> Greetings, > >> Mirko > >> > >> 2007/5/20, Mirko Hansen <[EMAIL PROTECTED]>: > >> > > >> >Hi, > >> > > >> >this patch fixes the problem that prevents showing the own emoticons in > >> >the chat window, if you use uppercase letters in your profile name. > >> > > >> >Greetings, > >> >Mirko > >> > > >> > > > > > > >> > >------------------------------------------------------------------------- > >> This SF.net email is sponsored by DB2 Express > >> Download DB2 Express C - the FREE version of DB2 express and take > >> control of your XML. No limits. Just data. Click to get it now. > >> http://sourceforge.net/powerbar/db2/ > >> _______________________________________________ > >> Amsn-devel mailing list > >> Amsn-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/amsn-devel > > > > > >------------------------------------------------------------------------- > >This SF.net email is sponsored by DB2 Express > >Download DB2 Express C - the FREE version of DB2 express and take > >control of your XML. No limits. Just data. Click to get it now. > >http://sourceforge.net/powerbar/db2/ > >_______________________________________________ > >Amsn-devel mailing list > >Amsn-devel@lists.sourceforge.net > >https://lists.sourceforge.net/lists/listinfo/amsn-devel > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Amsn-devel mailing list > Amsn-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amsn-devel ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Amsn-devel mailing list Amsn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amsn-devel