View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001864 | JEDI VCL | 00 JVCL Components | public | 2004-06-15 13:11 | 2004-06-25 04:59 |
Reporter | anonymous | Assigned To | user72 | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0001864: Spelling checker does not check last word | ||||
Description | The JV spelling checker implementation does not find a misspelled word if the work is at the end of the text, e.g. given the text 'slurm then glagnar', 'slurm' will found as a potential misspelling, but 'glagnar' will not. Workaround: put a space on the nd of the text | ||||
Additional Information | I have started a DUnit test case that exhibits this bug. It is attached. | ||||
Tags | No tags attached. | ||||
2004-06-15 13:11
|
DUnit_TestSpell.pas (3,749 bytes) |
|
The following changes seems to resolve the issues you are having (in JvSpellChecker.pas): function GetNextWord(var S: PAnsiChar; out Word: AnsiString; Delimiters: TSysCharSet): Boolean; var Start: PAnsiChar; begin Word := ''; Result := (S = nil); if Result then Exit; Start := nil; while True do begin if S^ = #0 then begin Word := Start; Result := Start <> nil; Exit; end else if S^ in Delimiters then begin if Start <> nil then begin SetString(Word, Start, S - Start); Exit; end else while (S^ in Delimiters) and (S^ <> #0) do Inc(S); end else begin if Start = nil then Start := S; Inc(S); end; end; end; function TJvDefaultSpellChecker.Next(out StartIndex, WordLength: Integer): WordBool; var S: PChar; begin StartIndex := 0; WordLength := 0; Result := False; if FPosition <= 0 then FPosition := 1; if FPosition >= Length(FText) then Exit; S := PChar(Text) + FPosition - 1; if (S = nil) or (S^ = #0) or (trim(S) = '') then Exit; while True do begin FCurrentWord := ''; GetNextWord(S, FCurrentWord, Delimiters); WordLength := Length(FCurrentWord); StartIndex := S - PChar(Text) - WordLength + 1; FPosition := StartIndex + WordLength; if (FCurrentWord <> '') and not CanIgnore(FCurrentWord) then begin FSuggestions.Clear; Result := not WordExists(FCurrentWord); if Result then begin GetWordSuggestions(FCurrentWord, FSuggestions); Break; end; end; if (S = nil) or (S^ = #0) or (trim(S) = '') then begin Result := False; Break; end; end; end; This passes the DUnit tests. BTW, I'll add the tests to our dev/dunit project as well |
|
No reply, so assuming it works (already in CVS) |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-06-15 13:11 | anonymous | New Issue | |
2004-06-15 13:11 | anonymous | File Added: DUnit_TestSpell.pas | |
2004-06-16 02:38 |
|
Note Added: 0004562 | |
2004-06-16 02:38 |
|
Status | new => assigned |
2004-06-16 02:38 |
|
Assigned To | => user72 |
2004-06-25 04:59 |
|
Status | assigned => resolved |
2004-06-25 04:59 |
|
Resolution | open => fixed |
2004-06-25 04:59 |
|
Note Added: 0004620 |