From 147b7ae4c498bfb116359c9b2929b5b7290abd15 Mon Sep 17 00:00:00 2001 From: Rod Kay Date: Tue, 16 Aug 2022 14:30:18 +1000 Subject: [PATCH] lace.text.forge: Rid 'CR' from line endings. --- 1-base/lace/source/text/lace-text-forge.adb | 13 +++++++++++-- 1-base/lace/source/text/lace-text-forge.ads | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/1-base/lace/source/text/lace-text-forge.adb b/1-base/lace/source/text/lace-text-forge.adb index 6fa5473..d15bc3a 100644 --- a/1-base/lace/source/text/lace-text-forge.adb +++ b/1-base/lace/source/text/lace-text-forge.adb @@ -22,8 +22,17 @@ is while not end_of_File (the_File) loop - append (Pad, get_Line (the_File) - & ada.Characters.Latin_1.LF); + declare + use ada.Characters; + Line : constant String := get_Line (the_File); + begin + if Line (Line'Last) = latin_1.CR + then + append (Pad, Line (Line'First .. Line'Last - 1) & latin_1.LF); + else + append (Pad, Line & latin_1.LF); + end if; + end; end loop; close (the_File); diff --git a/1-base/lace/source/text/lace-text-forge.ads b/1-base/lace/source/text/lace-text-forge.ads index 40fa40f..a3c5dc2 100644 --- a/1-base/lace/source/text/lace-text-forge.ads +++ b/1-base/lace/source/text/lace-text-forge.ads @@ -10,8 +10,8 @@ is type Filename is new String; - function to_String (Filename : in forge.Filename) return String; - function to_Text (Filename : in forge.Filename) return Item; + function to_String (Filename : in forge.Filename) return String; -- Converts 'CR & LF' to 'LF' at the end of a line. + function to_Text (Filename : in forge.Filename) return Item; -- Converts 'CR & LF' to 'LF' at the end of a line. --------------