From 3116f12c1bce86a74b404c31bae1ef3e63584478 Mon Sep 17 00:00:00 2001 From: skalogryz Date: Thu, 12 Aug 2010 13:38:48 +0000 Subject: [PATCH] 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 --- components/chelper/tosourceeditor.pas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/chelper/tosourceeditor.pas b/components/chelper/tosourceeditor.pas index 0806ff7b1..4751241b6 100644 --- a/components/chelper/tosourceeditor.pas +++ b/components/chelper/tosourceeditor.pas @@ -165,8 +165,8 @@ begin if Assigned(CtoPasConfig) then CtoPasConfig.UIToSettings; - i:=editor.CursorTextXY.Y; - dec(i); + st:=editor.CursorTextXY; + i:=st.Y-1; if i<0 then i:=0; txt:=''; for i:=i to editor.Lines.Count-1 do @@ -174,8 +174,7 @@ begin if DoConvertCode(txt, p, s) then begin - inc(p.Y, editor.CursorTextXY.Y-1); - st:=editor.CursorTextXY; + inc(p.Y, st.Y-1); st.X:=1; editor.ReplaceText(st, p, s); if Assigned(CtoPasConfig) then