EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Auto Replace Question

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
mstaszew



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Mon Aug 14, 2006 6:43 pm    Post subject: Auto Replace Question Reply with quote

Are there any known issues with the auto replace? Sometimes it won't work for me if I open a file and type a word to be autoreplaced. Taking the demo app for instance and the default auto replace list which contains 3 entires, if I open a file and go in the middle and type "thsi<space\return>" then it won't always update. If I start from a blank document though and do the same then it updates. If I go to the next line and repeat for one of the other auto replace items like "ad" or "gte" then it will work most of the time, but sometimes it does not. Is anyone else experiencing this behavior?

Thanks.
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Wed Aug 16, 2006 3:02 am    Post subject: Reply with quote

Fixing (ecAutoReplace.pas):

Code:
procedure TSyntAutoReplace.TextChanged(Sender: TObject; Pos, Count,
  LineChange: integer);
var ws, we, i: integer;
    RStr: ecString;
    p: TPoint;
begin
  if FEnabled and (Count >= 1) and (Count <= 2) then
   with FSyntMemo do
    begin
     for i := 1 to Count do
      if IsWordChar(Lines.Chars[Pos + i]) then Exit;
     if IsWordChar(Lines.Chars[Pos]) then
       begin
        WordRangeAtPos(StrPosToCaretPos(Pos - 1), ws, we);
        if (ws < we) and FindReplaceItem(Lines.SubString(ws + 1, we - ws), RStr) and
            DoReplace(RStr, ws, we - ws) and (Length(RStr) <> we - ws) then
         begin
          p := CaretPos;
          p.X := p.X + Length(RStr) - we + ws + 1;
          if p.X < 0 then p.X := 0;
          CaretPos := p;
         end;
       end;
    end;
end;


Michael.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group