added cat_lines convenience;
authorwenzelm
Thu, 12 Jan 2012 20:58:17 +0100
changeset 46196 805de058722b
parent 46195 d4558296bdc3
child 46197 e4da482283ef
added cat_lines convenience;
src/Pure/System/session.scala
src/Pure/library.scala
src/Tools/jEdit/src/isabelle_rendering.scala
--- a/src/Pure/System/session.scala	Thu Jan 12 20:57:37 2012 +0100
+++ b/src/Pure/System/session.scala	Thu Jan 12 20:58:17 2012 +0100
@@ -120,7 +120,7 @@
   def current_syntax(): Outer_Syntax = syntax
 
   @volatile private var reverse_syslog = List[XML.Elem]()
-  def syslog(): String = reverse_syslog.reverse.map(msg => XML.content(msg).mkString).mkString("\n")
+  def syslog(): String = cat_lines(reverse_syslog.reverse.map(msg => XML.content(msg).mkString))
 
   @volatile private var _phase: Session.Phase = Session.Inactive
   private def phase_=(new_phase: Session.Phase)
--- a/src/Pure/library.scala	Thu Jan 12 20:57:37 2012 +0100
+++ b/src/Pure/library.scala	Thu Jan 12 20:58:17 2012 +0100
@@ -98,6 +98,8 @@
 
   /* strings */
 
+  def cat_lines(lines: TraversableOnce[String]): String = lines.mkString("\n")
+
   def quote(s: String): String = "\"" + s + "\""
   def commas(ss: Iterable[String]): String = ss.iterator.mkString(", ")
   def commas_quote(ss: Iterable[String]): String = ss.iterator.mkString("\"", ", ", "\"")
@@ -208,7 +210,7 @@
 
   val space_explode = Library.space_explode _
   val split_lines = Library.split_lines _
-
+  val cat_lines = Library.cat_lines _
   val quote = Library.quote _
   val commas = Library.commas _
   val commas_quote = Library.commas_quote _
--- a/src/Tools/jEdit/src/isabelle_rendering.scala	Thu Jan 12 20:57:37 2012 +0100
+++ b/src/Tools/jEdit/src/isabelle_rendering.scala	Thu Jan 12 20:58:17 2012 +0100
@@ -102,7 +102,7 @@
             Pretty.string_of(List(msg), margin = Isabelle.Int_Property("tooltip-margin")))
       }) match {
         case Text.Info(_, msgs) #:: _ if !msgs.isEmpty =>
-          Some(msgs.iterator.map(_._2).mkString("\n"))
+          Some(cat_lines(msgs.iterator.map(_._2)))
         case _ => None
       }
 
@@ -256,7 +256,7 @@
       (tip1 match { case Text.Info(_, Some(text)) #:: _ => List(text) case _ => Nil }) :::
       (tip2 match { case Text.Info(_, Some(text)) #:: _ => List(text) case _ => Nil })
 
-    if (tips.isEmpty) None else Some(tips.mkString("\n"))
+    if (tips.isEmpty) None else Some(cat_lines(tips))
   }
 
   private val subexp_include =