Spell check sensitive to starting cursor position

  • I have a WPRichText control attached to a Developer Express toolbar by means of the WPTools standard actions, with WPSpell for spell checking.

    If I click on the spell check button on the toolbar, I always get a 'Spell check is complete' message unless my cursor is immediately before the first misspelled word in the text, or anywhere after the first misspelled word. Also, if my cursor is in the middle of a misspelled, only the part of the word after the cursor is brought up inside the correction dialog. To put it a little differently, if all the words between the start of my document and the cursor are spelled correctly, and there is at least one correctly spelled word after the cursor, the spell check never seems to run.

    The spell-as-you-go button seems to work with no problems, highlighting all misspelled words as expected.

    As far as I can tell, I haven't deviated from the instructions in the manual. Am I doing something incorrectly?

    • Offizieller Beitrag

    WPSpell uses a non modal dialog which uses the cursor position to start the spellcheck. I aggree it is a problem that it does start in the middle of a word though. I am not sure if it should jump to the beginning of the current word or to the end (suggestions?)

    If you insert this code

    Code
    //go to start of word when doing spellcheck
      if (Mode=wpStartSpellCheck) then
      begin
        while not ActiveParagraph.IsWordDelimiter(ActivePosInPar)
               and CPMoveBack do;
      end;

    into function TWPCustomRtfEdit.StartSpellCheck in unit WPCtrMemo it will automatically go to start of word. This will work for WPSpell and also Addict.

    Regards,
    Julian

  • Thanks for the code above. That seems to solve the one problem. I have nailed down the other problem to the fact that single-letter words seem to stop the spell-check, which seems to be related to the following code in TWPToolsSpellInterface.GetNextWord in WPSpell_link.pas:

    Code
    if fr then while (l > 0) and par.IsWordDelimiter(pos + l-1) do dec(l);
            if l > 1 then break;

    Consider the following sentence:

    Zitat

    This is a tesst. I have found a bug in thhe spell chck.

    The spell check stops at the words 'a', 'I' and 'a', depending on where you position the cursor. If you position the cursor anywhere before the first 'a', or anywhere after 'tesst.' and before the second 'a', the spell-check will return saying 'Spell check complete' even though not all the words have been checked.