proper treatment of empty lines (amending 08f89f0e8a62);
authorwenzelm
Sun, 14 Aug 2022 11:39:28 +0200
changeset 75859 7164f537370f
parent 75858 657b2de27454
child 75860 2b2c09f4e7b5
proper treatment of empty lines (amending 08f89f0e8a62);
src/Pure/library.scala
--- a/src/Pure/library.scala	Sun Aug 14 11:20:10 2022 +0200
+++ b/src/Pure/library.scala	Sun Aug 14 11:39:28 2022 +0200
@@ -94,8 +94,10 @@
 
   /* lines */
 
-  def terminate_lines(lines: IterableOnce[String]): String =
-    lines.iterator.mkString("", "\n", "\n")
+  def terminate_lines(lines: IterableOnce[String]): String = {
+    val it = lines.iterator
+    if (it.isEmpty) "" else it.mkString("", "\n", "\n")
+  }
 
   def cat_lines(lines: IterableOnce[String]): String =
     lines.iterator.mkString("\n")