CPWord and AfterCompleteWordEvent behavior compared to v3

  • AfterWordComplete event is being used for the obvious reasons. I wanted to share some unexpected behavior relating to CPWord.

    Comparing the the behavior in version 3, after you complete a word using [space], [periods], ?'s etc, CPWord would reflect the previously completed word, for example typing:

    Apple.

    editor.CPWord = 'Apple'

    Adding an additional period after the first period like so:

    Apple..

    editor.CPWord equals nothing.

    However in v6.29, typing the second period after the first period leaves CPWord = 'Apple'
    A third period CPWord equals nothing as expected.

    Is this expected behavior?

    Regards,

  • Hello, I've researched this issue and appears that the change mentioned in the following post may have something to do with the CPWord issue during AfterCompleteWordEvent.


    Once I commented out the following line from WPCTRMemo.pas function TWPCustomRtfEdit.GetCPWord, CPWord is now working as expected... CPWord is blank after the second delimiter when in AfterCompleteWordEvent.

    Code
    if active_paragraph = nil then exit;
          pc := active_posinpar;
    
    
    //    fix CPWord issue in AfterCompleteWordEvents
    //    if FInAfterCompleteWordEvent then dec(pc);

    However, I was unable to see how commenting this line out would negatively impact other aspects of the component.