[Script] Use tab complete to spellcheck
Added by Per Amundsen over 6 years ago
If the current word is not currently being tab-completed, replace a misspelled word with the first spellcheck match.
May not work for every case.
on *:TABCOMP:*:{ var %text $editbox($active) ; Check if AdiIRC is currently doing tab-complete. if ($1- == %text) { var %word $editbox($active).spellcheckword ; Lookup the word in the dictionary and get the first corrected match. var %spellcheck = $spellcheck(%word, 1) ; If the lookup was successful and the match was different than the spellcheck word. if (%spellcheck && %spellcheck != %word) { var %pos = $calc($editbox($active).selstart - 1) ; Find the first white space to the left of the spellcheck word. while (%pos > 0 && $mid(%text, %pos, 1) != $chr(32)) { dec %pos } ; Replace the editbox text with combined text left of the spellcheck word + corrected match + text right of the spellcheck word. ; Also set the selection to the end of the corrected match. editbox -b $+ $calc(%pos + $len(%spellcheck) + 1) $qt($active) $left(%text, %pos) $+ %spellcheck $+ $mid(%text, $calc(%pos + $len(%word) + 1), $len(%text))) halt } } }