src/Tools/jEdit/src/text_area_painter.scala
changeset 43428 b41dea5772c6
parent 43426 24e2e2f0032b
child 43434 2fd41645813d
     1.1 --- a/src/Tools/jEdit/src/text_area_painter.scala	Sat Jun 18 00:03:58 2011 +0200
     1.2 +++ b/src/Tools/jEdit/src/text_area_painter.scala	Sat Jun 18 00:05:29 2011 +0200
     1.3 @@ -90,10 +90,10 @@
     1.4              val line_range = doc_view.proper_line_range(start(i), end(i))
     1.5  
     1.6              // background color: status
     1.7 -            val cmds = snapshot.node.command_range(snapshot.revert(line_range))
     1.8              for {
     1.9 -              (command, command_start) <- cmds if !command.is_ignored
    1.10 -              val range = line_range.restrict(snapshot.convert(command.range + command_start))
    1.11 +              (command, command_start) <- snapshot.node.command_range(snapshot.revert(line_range))
    1.12 +              if !command.is_ignored
    1.13 +              range <- line_range.try_restrict(snapshot.convert(command.range + command_start))
    1.14                r <- Isabelle.gfx_range(text_area, range)
    1.15                color <- Isabelle_Markup.status_color(snapshot, command)
    1.16              } {
    1.17 @@ -220,8 +220,10 @@
    1.18          val chunk_color = chunk.style.getForegroundColor
    1.19  
    1.20          val markup =
    1.21 -          painter_snapshot.select_markup(chunk_range)(Isabelle_Markup.foreground)
    1.22 -            .map(_.restrict(chunk_range))
    1.23 +          for {
    1.24 +            x <- painter_snapshot.select_markup(chunk_range)(Isabelle_Markup.foreground)
    1.25 +            y <- x.try_restrict(chunk_range)
    1.26 +          } yield y
    1.27  
    1.28          gfx.setFont(chunk_font)
    1.29          if (!Debug.DISABLE_GLYPH_VECTOR && chunk.gv != null &&
    1.30 @@ -233,11 +235,10 @@
    1.31          else if (!markup.isEmpty) {
    1.32            var x1 = x + w
    1.33            for {
    1.34 -            Text.Info(r, info) <-
    1.35 +            Text.Info(range, info) <-
    1.36                Iterator(Text.Info(Text.Range(chunk_range.start, markup.head.range.start), None)) ++
    1.37                markup.iterator ++
    1.38                Iterator(Text.Info(Text.Range(markup.last.range.stop, chunk_range.stop), None))
    1.39 -            val range = r.restrict(chunk_range)
    1.40              if !range.is_singularity
    1.41            } {
    1.42              val str = chunk.str.substring(range.start - chunk_offset, range.stop - chunk_offset)