src/Tools/jEdit/src/isabelle_rendering.scala
changeset 49493 db58490a68ac
parent 49492 2e3e7ea5ce8e
child 49554 7b7bd2d7661d
equal deleted inserted replaced
49492:2e3e7ea5ce8e 49493:db58490a68ac
   237             }
   237             }
   238         }) match { case Text.Info(_, info :: _) #:: _ => Some(info) case _ => None }
   238         }) match { case Text.Info(_, info :: _) #:: _ => Some(info) case _ => None }
   239   }
   239   }
   240 
   240 
   241 
   241 
   242   def sendback(range: Text.Range): Option[Text.Info[Sendback]] =
   242   def sendback(range: Text.Range): Option[Text.Info[Document.Exec_ID]] =
   243   {
   243   {
   244     snapshot.select_markup(range, Some(Set(Isabelle_Markup.SENDBACK)),
   244     val results =
   245         {
   245       snapshot.cumulate_markup[(Option[Document.Exec_ID], Option[Text.Range])](range,
   246           case Text.Info(info_range, Protocol.Sendback(body)) =>
   246         (None, None), Some(messages_include + Isabelle_Markup.SENDBACK),
   247             Text.Info(snapshot.convert(info_range), body)
   247           {
   248         }) match
   248             case ((_, info), Text.Info(_, XML.Elem(Markup(name, Position.Id(id)), _)))
   249     {
   249             if messages_include(name) => (Some(id), info)
   250       case Text.Info(_, Text.Info(range, body)) #:: _ =>
   250 
   251         snapshot.node.command_at(range.start)
   251             case ((id, _), Text.Info(info_range, XML.Elem(Markup(Isabelle_Markup.SENDBACK, _), _))) =>
   252           .map(command_range => Text.Info(range, Sendback(command_range._1, body)))
   252               (id, Some(snapshot.convert(info_range)))
       
   253           })
       
   254 
       
   255     (for (Text.Info(_, (Some(id), Some(r))) <- results) yield Text.Info(r, id)) match {
       
   256       case res #:: _ => Some(res)
   253       case _ => None
   257       case _ => None
   254     }
   258     }
   255   }
   259   }
   256 
   260 
   257 
   261 
   373       color <- squiggly_colors.get(pri)
   377       color <- squiggly_colors.get(pri)
   374     } yield Text.Info(r, color)
   378     } yield Text.Info(r, color)
   375   }
   379   }
   376 
   380 
   377 
   381 
       
   382   private val messages_include =
       
   383     Set(Isabelle_Markup.WRITELN_MESSAGE, Isabelle_Markup.TRACING_MESSAGE,
       
   384       Isabelle_Markup.WARNING_MESSAGE, Isabelle_Markup.ERROR_MESSAGE)
       
   385 
   378   private val message_colors = Map(
   386   private val message_colors = Map(
   379     Isabelle_Rendering.writeln_pri -> writeln_message_color,
   387     Isabelle_Rendering.writeln_pri -> writeln_message_color,
   380     Isabelle_Rendering.tracing_pri -> tracing_message_color,
   388     Isabelle_Rendering.tracing_pri -> tracing_message_color,
   381     Isabelle_Rendering.warning_pri -> warning_message_color,
   389     Isabelle_Rendering.warning_pri -> warning_message_color,
   382     Isabelle_Rendering.error_pri -> error_message_color)
   390     Isabelle_Rendering.error_pri -> error_message_color)
   383 
   391 
   384   def line_background(range: Text.Range): Option[(Color, Boolean)] =
   392   def line_background(range: Text.Range): Option[(Color, Boolean)] =
   385   {
   393   {
   386     val messages =
       
   387       Set(Isabelle_Markup.WRITELN_MESSAGE, Isabelle_Markup.TRACING_MESSAGE,
       
   388         Isabelle_Markup.WARNING_MESSAGE, Isabelle_Markup.ERROR_MESSAGE)
       
   389     val results =
   394     val results =
   390       snapshot.cumulate_markup[Int](range, 0, Some(messages),
   395       snapshot.cumulate_markup[Int](range, 0, Some(messages_include),
   391         {
   396         {
   392           case (pri, Text.Info(_, XML.Elem(Markup(name, _), _)))
   397           case (pri, Text.Info(_, XML.Elem(Markup(name, _), _)))
   393           if name == Isabelle_Markup.WRITELN_MESSAGE ||
   398           if name == Isabelle_Markup.WRITELN_MESSAGE ||
   394             name == Isabelle_Markup.TRACING_MESSAGE ||
   399             name == Isabelle_Markup.TRACING_MESSAGE ||
   395             name == Isabelle_Markup.WARNING_MESSAGE ||
   400             name == Isabelle_Markup.WARNING_MESSAGE ||