[PATCH] Sonnet::Highlighter API additions

John Tapsell johnflux at gmail.com
Fri May 2 16:30:21 BST 2008


Is it worth having a parameter for suggestionsForWord to specify the
maximum number of results to return?  (e.g 5 or so)

2008/5/2 Thomas McGuire <thomas.mcguire at gmx.net>:
> Hi,
>
>  attached is a patch that makes some changes to the Sonnet highlighter.
>
>  The reason why this patch is needed is that the current method of suggesting
>  replacements for a misspelled word is horribly inefficient: When a misspelled
>  word is detected, the highlighter emits newSuggestions(QString,QStringList),
>  which has the wrong word and a list of suggestions as parameters. The client
>  (KMail in this case) then has to store a map of wrong words and their
>  replacement suggestions. With long texts, this map can get quite big,
>  especially because words are marked wrong when writing them, so the signal is
>  emitted for word-fragments as well (for example, "ex", "exa", etc for
>  "example").
>
>  This patch adds 2 new functions, isWordMisspelled() and suggestionsForWord(),
>  which eliminate the need for that map.
>  The old newSuggestions() signal is deprecated.
>
>  While I was at it, I added ignoreWord() and newSuggestions(), so that a "Add
>  to Dictionary" and "Ignore" actions are finally possible within context-menus.
>
>  I also removed some tabs.
>
>  Is it OK to commit this?
>
>  Regards,
>  Thomas
>




More information about the kde-core-devel mailing list