diff --git a/components/synedit/syneditviewedlinemap.pp b/components/synedit/syneditviewedlinemap.pp index 79cac3f311..f9055b4224 100644 --- a/components/synedit/syneditviewedlinemap.pp +++ b/components/synedit/syneditviewedlinemap.pp @@ -876,20 +876,15 @@ var CurrentPage: TSynEditLineMapPageHolder; begin CurrentPage := FindPageForLine(ALineIdx, afmPrev); - if not CurrentPage.HasPage then begin - CurrentPage := FirstPage; - if not CurrentPage.HasPage then begin - CurrentPage := FindPageForLine(ALineIdx, afmCreate); - if not CurrentPage.HasPage then - exit; - end; - end; // inherited => moves any node with FStartLine >= AStartLine inherited AdjustForLinesInserted(ALineIdx, ALineCount); -// TODO ::::XXXXX ONLY if inside the page / otherwise call invalidate - CurrentPage.AdjustForLinesInserted(ALineIdx, ALineCount, ABytePos); + // CurrentPage.StartLine is still the old value + if CurrentPage.HasPage then + CurrentPage.AdjustForLinesInserted(ALineIdx, ALineCount, ABytePos) + else + InvalidateLines(ALineIdx, ALineIdx+ALineCount-1); end; procedure TSynLineMapAVLTree.AdjustForLinesDeleted(AStartLine, ALineCount,