mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-26 12:23:51 +02:00
jcf: don't replace lines but insert them if we are after the source end - fixes issue #0021493
git-svn-id: trunk@36187 -
This commit is contained in:
parent
0e0b2fa192
commit
5461d16beb
@ -169,6 +169,7 @@ var
|
||||
lcSameStart, lcSameEnd: TStrings;
|
||||
lsSourceLine, lsDestLine: string;
|
||||
liStart, liIndex, liMaxIndex: integer;
|
||||
hasSourceLine: Boolean;
|
||||
begin
|
||||
if pcUnit = nil then
|
||||
exit;
|
||||
@ -191,7 +192,8 @@ begin
|
||||
liMaxIndex := Max(lcSourceLines.Count, lcDestLines.Count);
|
||||
while (liIndex < liMaxIndex) do
|
||||
begin
|
||||
if liIndex < lcSourceLines.Count then
|
||||
hasSourceLine := liIndex < lcSourceLines.Count;
|
||||
if hasSourceLine then
|
||||
lsSourceLine := lcSourceLines[liIndex]
|
||||
else
|
||||
lsSourceLine := '';
|
||||
@ -201,6 +203,9 @@ begin
|
||||
else
|
||||
lsDestLine := '';
|
||||
|
||||
if not hasSourceLine then
|
||||
pcUnit.InsertLine(liStart + liIndex + 1, lsDestLine, True)
|
||||
else
|
||||
if not AnsiSameStr(lsSourceLine, lsDestLine) then
|
||||
// the line is different, replace it
|
||||
pcUnit.ReplaceLines(liStart + liIndex + 1, liStart + liIndex + 1, lsDestLine, True);
|
||||
|
Loading…
Reference in New Issue
Block a user