how could program detect wrapped link in plaintext? surprise me :-)
-marek_mikus
Why not use the existing spellchecker? Here's how, I'll use the link to this thread as an example as it is fairly representative of many URLs...
http:://www.donationcoder.com/forum/index.php?topic=11985.0#quickreply (FYI - I put in two colons so the SMF engine wouldn't compact the URL)
-=o=- First, like Superboyac saiid, it is a long string without spaces...
-=o=- Next, if you split this at just about any point it is basically unintelligible jibberish as far as a spell check is concerned. Yes, I do see that a split between "quick" and "reply" might get past this, but this is far and away the exception and not the rule; in fact, the chances of the split actually occurring at a chance intelligible break like that would be astornomical. Also given it was jibberish to start with, it seems an "intellegent" parser would be able to identify the string as a URL (the "http;//" at the beginnig of the string would be a big hint) and could be "marked" in the editor to treat it as "Do not break" when lines are wrapped.
-=o=- Now we have two split lines. For the sake of argument we'll say both are unintelligible strings that could/will be flagged by the spellcheck.
Obviously, any string that starts with "http://...", "https://..." or "ftp://..." is easily identified as an URL or FTP address. What about the backend?
-=o=- The back end will more than likely be unintelligible jibberish, as I said, but here is the key... the positively identified front end will
always be at the end of the line as the
last "word" on the line and the back end will
always be the very
first "word" of the next line. An exception could be a URL/FTP address that is verrrrry lonnnnng. In that case the first part is the positively identified address which is the last "word" on a line. The next line would be complete jibberish with no spaces and the next and the next, etc. The last part of the string would still be the first "word" of the next line. I realize that even the "http//" part could be split anywhere in the string, but think about it... no where could it be split and be the beginning or end of any English word that I know of.
-=o=- So with what we have established above, it would seem a simple matter to parse using the exisiting spellcheck engine (if it can be used during the wrapping process) to identify and keep together a URL/FTP address. There would needs be more code to make this all happen, but that shouldn't be any kind of hurdle. Probably, a few lines of code. At least, the logic picture is pretty straightforward. Franly, I think "marking" the string as a special entity would be the simplest approach, but the parsing method should work as well and it wouldn't take too much more effort to even repair broken URL strings from an original e-mail.
Is this doable in TheBAT!
I'm with Superboyac... this has plagued e-mail clients (and other editors) since the beginnig. Let's get it out of the way!
<edit> customary spell corrections and clarifications </edit> Mouser, can we have a button installed to frame our edit remarks?