chelper: fix code replacement. the header's code could be corrupted if user changes cursor position, while converting process works

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1278 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2010-08-12 13:38:48 +00:00
parent 03694fedf4
commit 3116f12c1b

View File

@@ -165,8 +165,8 @@ begin
if Assigned(CtoPasConfig) then CtoPasConfig.UIToSettings; if Assigned(CtoPasConfig) then CtoPasConfig.UIToSettings;
i:=editor.CursorTextXY.Y; st:=editor.CursorTextXY;
dec(i); i:=st.Y-1;
if i<0 then i:=0; if i<0 then i:=0;
txt:=''; txt:='';
for i:=i to editor.Lines.Count-1 do for i:=i to editor.Lines.Count-1 do
@@ -174,8 +174,7 @@ begin
if DoConvertCode(txt, p, s) then if DoConvertCode(txt, p, s) then
begin begin
inc(p.Y, editor.CursorTextXY.Y-1); inc(p.Y, st.Y-1);
st:=editor.CursorTextXY;
st.X:=1; st.X:=1;
editor.ReplaceText(st, p, s); editor.ReplaceText(st, p, s);
if Assigned(CtoPasConfig) then if Assigned(CtoPasConfig) then