|
EControl Ltd. VCL libraries and software support forum
|
View previous topic :: View next topic |
Author |
Message |
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Mon Aug 14, 2006 6:43 pm Post subject: Auto Replace Question |
|
|
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 |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Wed Aug 16, 2006 3:02 am Post subject: |
|
|
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 |
|
|
|
|
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
|