diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-02-04 18:58:10 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-02-04 18:58:13 +0100 |
commit | 10dbbfb98cee33b06ca19e936732309725d0fdf9 (patch) | |
tree | 1ab118b7cafd0175f6093b1cf7ac1ecdc502f877 /src/files_map-editor.adb | |
parent | a3c8e965181a81710d1da42a32e0efcd376df1bb (diff) | |
download | ghdl-10dbbfb98cee33b06ca19e936732309725d0fdf9.tar.gz ghdl-10dbbfb98cee33b06ca19e936732309725d0fdf9.tar.bz2 ghdl-10dbbfb98cee33b06ca19e936732309725d0fdf9.zip |
files_map-editor: fix file_length when moving gap at end.
Diffstat (limited to 'src/files_map-editor.adb')
-rw-r--r-- | src/files_map-editor.adb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/files_map-editor.adb b/src/files_map-editor.adb index d339f3578..1cf5bd947 100644 --- a/src/files_map-editor.adb +++ b/src/files_map-editor.adb @@ -193,6 +193,8 @@ package body Files_Map.Editor is F.Source (New_Start .. New_Start + Diff - 1); if F.Gap_Start >= F.File_Length then + -- The gap was after the EOT. As it is moved before, we need + -- to increase the file length. F.File_Length := F.File_Length + Gap_Len; end if; @@ -213,7 +215,8 @@ package body Files_Map.Editor is F.Source (F.Gap_Start .. F.Gap_Start + Diff - 1) := F.Source (F.Gap_Last + 1 .. F.Gap_Last + 1 + Diff - 1); - if New_Start + Gap_Len >= F.File_Length then + if New_Start + Gap_Len > F.File_Length then + -- Moved past the end of file. Decrease the file length. F.File_Length := F.File_Length - Gap_Len; end if; |