aboutsummaryrefslogtreecommitdiffstats
path: root/src/files_map-editor.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-06 18:16:54 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-06 18:16:54 +0100
commita824b082fa9ed2f97aaed344f1e02aac3aca47c4 (patch)
treede877d0135b17a8e46403449ffc7560cd2662443 /src/files_map-editor.adb
parent0612f8baeb5f0e7a6dec729691a291ba0ce631c4 (diff)
downloadghdl-a824b082fa9ed2f97aaed344f1e02aac3aca47c4.tar.gz
ghdl-a824b082fa9ed2f97aaed344f1e02aac3aca47c4.tar.bz2
ghdl-a824b082fa9ed2f97aaed344f1e02aac3aca47c4.zip
files_map-editor: check and clear cache line.
Diffstat (limited to 'src/files_map-editor.adb')
-rw-r--r--src/files_map-editor.adb12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/files_map-editor.adb b/src/files_map-editor.adb
index 250bd0081..f8ed6b10b 100644
--- a/src/files_map-editor.adb
+++ b/src/files_map-editor.adb
@@ -113,6 +113,10 @@ package body Files_Map.Editor is
if Lines_Tables.Last (F.Lines) /= L then
Log_Line ("incorrect number of lines");
end if;
+
+ if F.Lines.Table (F.Cache_Line) /= F.Cache_Pos then
+ Log_Line ("incorrect position of cache line");
+ end if;
end Check_Buffer_Lines;
-- Compute the number of character in FILE between [START_POS; END_POS)
@@ -216,6 +220,10 @@ package body Files_Map.Editor is
-- Adjust gap.
F.Gap_Start := New_Start;
F.Gap_Last := New_Start + Gap_Len - 1;
+
+ -- Clear cache.
+ F.Cache_Line := 1;
+ F.Cache_Pos := Source_Ptr_Org;
end Move_Gap;
-- Count the number of newlines (LF, CR, LF+CR or CR+LF) in TEXT.
@@ -344,6 +352,10 @@ package body Files_Map.Editor is
end if;
end loop;
+ -- Clear cache.
+ F.Cache_Line := 1;
+ F.Cache_Pos := Source_Ptr_Org;
+
Check_Buffer_Lines (File);
end;
end;