src/Tools/jEdit/src/jedit/document_view.scala
changeset 39181 2257eded8323
parent 39178 83e9f3ccea9f
child 39182 cce0c10ed943
equal deleted inserted replaced
39180:e1d160a9bd5f 39181:2257eded8323
   243 
   243 
   244               // squiggly underline
   244               // squiggly underline
   245               for {
   245               for {
   246                 Text.Info(range, Some(color)) <-
   246                 Text.Info(range, Some(color)) <-
   247                   snapshot.select_markup(line_range)(Isabelle_Markup.message).iterator
   247                   snapshot.select_markup(line_range)(Isabelle_Markup.message).iterator
   248                 if color != null
       
   249                 r <- Isabelle.gfx_range(text_area, range)
   248                 r <- Isabelle.gfx_range(text_area, range)
   250               } {
   249               } {
   251                 gfx.setColor(color)
   250                 gfx.setColor(color)
   252                 val x0 = (r.x / 2) * 2
   251                 val x0 = (r.x / 2) * 2
   253                 val y0 = r.y + ascent + 1
   252                 val y0 = r.y + ascent + 1
   297           for (i <- 0 until physical_lines.length) {
   296           for (i <- 0 until physical_lines.length) {
   298             if (physical_lines(i) != -1) {
   297             if (physical_lines(i) != -1) {
   299               val line_range = proper_line_range(start(i), end(i))
   298               val line_range = proper_line_range(start(i), end(i))
   300 
   299 
   301               // gutter icons
   300               // gutter icons
   302               val cmds = snapshot.node.command_range(snapshot.revert(line_range))
   301               val icons =
   303               val states = cmds.map(p => snapshot.state(p._1)).toStream
   302                 (for (Text.Info(_, Some(icon)) <-
   304               val opt_icon =
   303                   snapshot.select_markup(line_range)(Isabelle_Markup.gutter_message).iterator)
   305                 if (states.exists(_.results.exists(p => Isar_Document.is_error(p._2))))
   304                 yield icon).toList.sortWith(_ >= _)
   306                   Some(Isabelle_Markup.error_icon)
   305               icons match {
   307                 else if (states.exists(_.results.exists(p => Isar_Document.is_warning(p._2))))
   306                 case icon :: _ =>
   308                   Some(Isabelle_Markup.warning_icon)
   307                   val icn = icon.icon
   309                 else None
   308                   val x0 = (FOLD_MARKER_SIZE + width - border_width - icn.getIconWidth) max 10
   310               opt_icon match {
   309                   val y0 = y + i * line_height + (((line_height - icn.getIconHeight) / 2) max 0)
   311                 case Some(icon) if icon.getIconWidth > 0 && icon.getIconHeight > 0 =>
   310                   icn.paintIcon(gutter, gfx, x0, y0)
   312                   val x0 = (FOLD_MARKER_SIZE + width - border_width - icon.getIconWidth) max 10
   311                 case Nil =>
   313                   val y0 = y + i * line_height + (((line_height - icon.getIconHeight) / 2) max 0)
       
   314                   icon.paintIcon(gutter, gfx, x0, y0)
       
   315                 case _ =>
       
   316               }
   312               }
   317             }
   313             }
   318           }
   314           }
   319         }
   315         }
   320       }
   316       }