jaytea commented on a Page, jaytea's Highlight Thing  -  May 14, 2012

hi! wow, thanks for investigating that :P

yeah it seems as though i entirely overlooked the prospect of excess spaces... or simply didn't want to handle them.... can't really remember. i've been battling with the 'excess spaces' problem in mIRC for as long as i can remember, and as much as i hate to leave the script in such a defeated state, the solution would require more time than i can afford to commit right now. i do have an easy way to fix it in your case though:

you'll notice the /findtext itself is not very precise. the /findtext ends up looking for that line, already stripped of excess spaces, anywhere in the buffer. thus it could potentially find too much (where the line is part of a larger line) or too little (where the line contains multiple consecutive spaces in the middle and therefore won't be found). i figured that since most people use timestamps, the first case was not likely to happen often enough to cause distress. now, in your case, mIRC needs to get a chance to "/findText [tstamp] Yawhatnever:" (trailing space gone), since it would then find the right line. the only problem is that it has to first pass successfully through $hl_findLine(). quickest solution is to just add '*' to the end of the search term, ie:

return $fline($2, $replace($3, *, ?) $+ *, 1)

now it resembles /findText in that it could report partial matches, but if you use a timestamp then the prospect of error is really slim. it isn't perfect, but i don't expect that the potential problems would cause anyone too much grief.

an almost bulletproof solution could be:

1) store the line in a way that retains information about excess spaces. maybe store the line as a regex (see below)
2) use $fline() with a regular expression (changing spaces to \x escapes etc.) to find the exact line
3) seek to the line using one or more /findTexts

number 3) is a bit complicated:

/findText will never be able to find a line containing excess spaces if you use those excess spaces in the search term. it is also limited in that it doesn't accept wildcards or any type of search other than a sort of "isin". we need to cut the line up, either before or after the first excess space and use that chunk in /findText. with this approach, we need to be able to know which line our next /findText is going to take us to. to do this, you can use /findText -n one or more times to seek to the last occurrence of in the buffer. the maximal number of times to do this can be found with $fline() and a precise search with regex. now you know that every /findText you do will take you back through $fline(, , N-1, 2) $fline(, , N-2, 2) $fline(, , N-3, 2) etc. and you can use $fline().text or $line() to retrieve the line currently in focus and compare it to the saved line and check for equality.

why is this almost bulletproof? because if your exists on several lines in a single message that wraps in your window, /findText will treat those as separate occurrences and cycle through them individually! but i think i have a better chance of being struck by lightning while cashing in a winning lottery ticket than witnessing that happen in practice.

Beautiful script though, I learned a lot just figuring out how it works :P

thank you :* glad people are still learning and playing with mIRC. i'll be back on regularly soon

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.