src/Tools/jEdit/src/rendering.scala
changeset 55646 ec4651c697e3
parent 55626 0e2b7f04c944
child 55647 106a57dec7af
equal deleted inserted replaced
55645:561754277494 55646:ec4651c697e3
   229 
   229 
   230   /* command status overview */
   230   /* command status overview */
   231 
   231 
   232   val overview_limit = options.int("jedit_text_overview_limit")
   232   val overview_limit = options.int("jedit_text_overview_limit")
   233 
   233 
   234   private val overview_elements =
       
   235     Protocol.command_status_markup + Markup.WARNING + Markup.ERROR
       
   236 
       
   237   def overview_color(range: Text.Range): Option[Color] =
   234   def overview_color(range: Text.Range): Option[Color] =
   238   {
   235   {
   239     if (snapshot.is_outdated) None
   236     if (snapshot.is_outdated) None
   240     else {
   237     else {
   241       val results =
   238       val results =
   242         snapshot.cumulate_markup[(Protocol.Status, Int)](
   239         snapshot.cumulate_markup[(Protocol.Status, Int)](
   243           range, (Protocol.Status.init, 0), overview_elements, _ =>
   240           range, (Protocol.Status.init, 0), Protocol.status_elements, _ =>
   244           {
   241           {
   245             case ((status, pri), Text.Info(_, elem)) =>
   242             case ((status, pri), Text.Info(_, elem)) =>
   246               if (Protocol.command_status_markup(elem.name))
   243               if (Protocol.command_status_elements(elem.name))
   247                 Some((Protocol.command_status(status, elem.markup), pri))
   244                 Some((Protocol.command_status(status, elem.markup), pri))
   248               else
   245               else
   249                 Some((status, pri max Rendering.message_pri(elem.name)))
   246                 Some((status, pri max Rendering.message_pri(elem.name)))
   250           })
   247           })
   251       if (results.isEmpty) None
   248       if (results.isEmpty) None
   532     Rendering.writeln_pri -> writeln_color,
   529     Rendering.writeln_pri -> writeln_color,
   533     Rendering.information_pri -> information_color,
   530     Rendering.information_pri -> information_color,
   534     Rendering.warning_pri -> warning_color,
   531     Rendering.warning_pri -> warning_color,
   535     Rendering.error_pri -> error_color)
   532     Rendering.error_pri -> error_color)
   536 
   533 
   537   private val squiggly_elements = Set(Markup.WRITELN, Markup.WARNING, Markup.ERROR)
   534   private val squiggly_elements =
       
   535     Set(Markup.WRITELN, Markup.WARNING, Markup.ERROR)
   538 
   536 
   539   def squiggly_underline(range: Text.Range): List[Text.Info[Color]] =
   537   def squiggly_underline(range: Text.Range): List[Text.Info[Color]] =
   540   {
   538   {
   541     val results =
   539     val results =
   542       snapshot.cumulate_markup[Int](range, 0, squiggly_elements, _ =>
   540       snapshot.cumulate_markup[Int](range, 0, squiggly_elements, _ =>
   595 
   593 
   596 
   594 
   597   /* text background */
   595   /* text background */
   598 
   596 
   599   private val background1_elements =
   597   private val background1_elements =
   600     Protocol.command_status_markup + Markup.WRITELN_MESSAGE + Markup.TRACING_MESSAGE +
   598     Protocol.command_status_elements + Markup.WRITELN_MESSAGE + Markup.TRACING_MESSAGE +
   601       Markup.WARNING_MESSAGE + Markup.ERROR_MESSAGE + Markup.BAD + Markup.INTENSIFY ++
   599       Markup.WARNING_MESSAGE + Markup.ERROR_MESSAGE + Markup.BAD + Markup.INTENSIFY ++
   602       active_elements
   600       active_elements
   603 
   601 
   604   def background1(range: Text.Range): List[Text.Info[Color]] =
   602   def background1(range: Text.Range): List[Text.Info[Color]] =
   605   {
   603   {
   609         Text.Info(r, result) <-
   607         Text.Info(r, result) <-
   610           snapshot.cumulate_markup[(Option[Protocol.Status], Option[Color])](
   608           snapshot.cumulate_markup[(Option[Protocol.Status], Option[Color])](
   611             range, (Some(Protocol.Status.init), None), background1_elements, command_state =>
   609             range, (Some(Protocol.Status.init), None), background1_elements, command_state =>
   612             {
   610             {
   613               case (((Some(status), color), Text.Info(_, XML.Elem(markup, _))))
   611               case (((Some(status), color), Text.Info(_, XML.Elem(markup, _))))
   614               if (Protocol.command_status_markup(markup.name)) =>
   612               if (Protocol.command_status_elements(markup.name)) =>
   615                 Some((Some(Protocol.command_status(status, markup)), color))
   613                 Some((Some(Protocol.command_status(status, markup)), color))
   616               case (_, Text.Info(_, XML.Elem(Markup(Markup.BAD, _), _))) =>
   614               case (_, Text.Info(_, XML.Elem(Markup(Markup.BAD, _), _))) =>
   617                 Some((None, Some(bad_color)))
   615                 Some((None, Some(bad_color)))
   618               case (_, Text.Info(_, XML.Elem(Markup(Markup.INTENSIFY, _), _))) =>
   616               case (_, Text.Info(_, XML.Elem(Markup(Markup.INTENSIFY, _), _))) =>
   619                 Some((None, Some(intensify_color)))
   617                 Some((None, Some(intensify_color)))