mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 16:30:53 +00:00
Check misspelled words reported by aspell against the user dictionaries
so that the current document's ignored words are not returned back to the spell checker. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29703 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5b80e81b15
commit
5277f2a90d
2 changed files with 24 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2010-02-22 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Tools/GSspell.m (-spellServer:findMisspelledWord...): Check
|
||||
misspelled words reported by aspell against the user dictionaries
|
||||
so that the current document's ignored words are not returned back
|
||||
to the spell checker.
|
||||
|
||||
2010-02-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSDisplayServer.h:
|
||||
|
|
|
@ -284,6 +284,8 @@ findMisspelledWordInString: (NSString *)stringToCheck
|
|||
const char *p;
|
||||
AspellToken token;
|
||||
AspellDocumentChecker *checker;
|
||||
NSRange r;
|
||||
NSString *word;
|
||||
int length;
|
||||
|
||||
if (countOnly)
|
||||
|
@ -300,11 +302,23 @@ findMisspelledWordInString: (NSString *)stringToCheck
|
|||
|
||||
checker = [self documentCheckerForLanguage: language];
|
||||
aspell_document_checker_process(checker, p, length);
|
||||
token = aspell_document_checker_next_misspelling(checker);
|
||||
|
||||
return NSMakeRange(uniLength((unsigned char *)p, token.offset),
|
||||
uniLength((unsigned char *)p + token.offset, token.len));
|
||||
/* Even though we add learned words to aspell's user dictionary, we must
|
||||
ask the server for words in its user dictionaries so that words that
|
||||
the user has ignored won't be returned as misspelled. */
|
||||
do
|
||||
{
|
||||
token = aspell_document_checker_next_misspelling(checker);
|
||||
if (token.len == 0)
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
|
||||
r = NSMakeRange(uniLength((unsigned char *)p, token.offset),
|
||||
uniLength((unsigned char *)p + token.offset, token.len));
|
||||
word = [stringToCheck substringWithRange: r];
|
||||
}
|
||||
while ([sender isWordInUserDictionaries: word caseSensitive: YES]);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
- (NSArray *) spellServer: (NSSpellServer *)sender
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue