mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 08:39:50 +01: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;
|
lcSameStart, lcSameEnd: TStrings;
|
||||||
lsSourceLine, lsDestLine: string;
|
lsSourceLine, lsDestLine: string;
|
||||||
liStart, liIndex, liMaxIndex: integer;
|
liStart, liIndex, liMaxIndex: integer;
|
||||||
|
hasSourceLine: Boolean;
|
||||||
begin
|
begin
|
||||||
if pcUnit = nil then
|
if pcUnit = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -191,7 +192,8 @@ begin
|
|||||||
liMaxIndex := Max(lcSourceLines.Count, lcDestLines.Count);
|
liMaxIndex := Max(lcSourceLines.Count, lcDestLines.Count);
|
||||||
while (liIndex < liMaxIndex) do
|
while (liIndex < liMaxIndex) do
|
||||||
begin
|
begin
|
||||||
if liIndex < lcSourceLines.Count then
|
hasSourceLine := liIndex < lcSourceLines.Count;
|
||||||
|
if hasSourceLine then
|
||||||
lsSourceLine := lcSourceLines[liIndex]
|
lsSourceLine := lcSourceLines[liIndex]
|
||||||
else
|
else
|
||||||
lsSourceLine := '';
|
lsSourceLine := '';
|
||||||
@ -201,6 +203,9 @@ begin
|
|||||||
else
|
else
|
||||||
lsDestLine := '';
|
lsDestLine := '';
|
||||||
|
|
||||||
|
if not hasSourceLine then
|
||||||
|
pcUnit.InsertLine(liStart + liIndex + 1, lsDestLine, True)
|
||||||
|
else
|
||||||
if not AnsiSameStr(lsSourceLine, lsDestLine) then
|
if not AnsiSameStr(lsSourceLine, lsDestLine) then
|
||||||
// the line is different, replace it
|
// the line is different, replace it
|
||||||
pcUnit.ReplaceLines(liStart + liIndex + 1, liStart + liIndex + 1, lsDestLine, True);
|
pcUnit.ReplaceLines(liStart + liIndex + 1, liStart + liIndex + 1, lsDestLine, True);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user