[Psi-Devel] [Patch] Spell checker doesn't handle abbreviated words

Norman Rasmussen norman at rasmussen.co.za
Sat Jun 28 14:09:03 PDT 2008


There's no point in even generating a file to attach for this one.  This
patch allows for quotes within words (need to avoid spell checking words
starting and ending with quotes).

My logic on removing the \b's is that the way regex defines and greedily
matches \w's implicitly means that there must be \b's around it.  Also the
way that Psi's
highlighting logic works, the matching starts searching after the end
of the last match, so
matching within a word is avoided.  Also this forces words to be at least
two characters before they'll be subject to the spell checker, which seems
fine because as far as I can tell, (with aspell at least), all one letter
words are 'valid'.

ref: http://doc.trolltech.com/4.4/qregexp.html#assertions

Index: psi/src/tools/spellchecker/spellhighlighter.cpp
===================================================================
--- psi/src/tools/spellchecker/spellhighlighter.cpp     (revision 1170)
+++ psi/src/tools/spellchecker/spellhighlighter.cpp     (working copy)
@@ -19,7 +19,7 @@
        }

        // Match words (minimally)
-       QRegExp expression("\\b\\w+\\b");
+       QRegExp expression("\\w[\\w']*\\w");

        // Iterate through all words
        int index = text.indexOf(expression);


- Norman Rasmussen
- Email: norman at rasmussen.co.za
- Home page: http://norman.rasmussen.co.za/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.affinix.com/pipermail/psi-devel-affinix.com/attachments/20080628/f3213fea/attachment.htm>


More information about the Psi-Devel mailing list