src/Tools/jEdit/src/jedit/isabelle_hyperlinks.scala
changeset 38580 881c362d48e4
parent 38577 4e4d3ea3725a
child 38582 3a6ce43d99b1
equal deleted inserted replaced
38579:ce46a6f55bce 38580:881c362d48e4
    47         val offset = snapshot.revert(buffer_offset)
    47         val offset = snapshot.revert(buffer_offset)
    48         snapshot.node.command_at(offset) match {
    48         snapshot.node.command_at(offset) match {
    49           case Some((command, command_start)) =>
    49           case Some((command, command_start)) =>
    50             val root = Text.Info[Hyperlink]((Text.Range(offset) - command_start), null)
    50             val root = Text.Info[Hyperlink]((Text.Range(offset) - command_start), null)
    51             (snapshot.state(command).markup.select(root) {
    51             (snapshot.state(command).markup.select(root) {
    52               case Text.Info(_, XML.Elem(Markup(Markup.ML_REF, _),
    52               case Text.Info(info_range, XML.Elem(Markup(Markup.ML_REF, _),
    53                   List(XML.Elem(Markup(Markup.ML_DEF, props), _)))) =>
    53                   List(XML.Elem(Markup(Markup.ML_DEF, props), _)))) =>
    54 //{{{
       
    55                 val info_range = root.range // FIXME proper range
       
    56                 val Text.Range(begin, end) = snapshot.convert(info_range + command_start)
    54                 val Text.Range(begin, end) = snapshot.convert(info_range + command_start)
    57                 val line = buffer.getLineOfOffset(begin)
    55                 val line = buffer.getLineOfOffset(begin)
    58 
    56 
    59                 (Position.get_file(props), Position.get_line(props)) match {
    57                 (Position.get_file(props), Position.get_line(props)) match {
    60                   case (Some(ref_file), Some(ref_line)) =>
    58                   case (Some(ref_file), Some(ref_line)) =>
    65                         snapshot.lookup_command(ref_id) match {
    63                         snapshot.lookup_command(ref_id) match {
    66                           case Some(ref_cmd) =>
    64                           case Some(ref_cmd) =>
    67                             snapshot.node.command_start(ref_cmd) match {
    65                             snapshot.node.command_start(ref_cmd) match {
    68                               case Some(ref_cmd_start) =>
    66                               case Some(ref_cmd_start) =>
    69                                 new Internal_Hyperlink(begin, end, line,
    67                                 new Internal_Hyperlink(begin, end, line,
    70                                   snapshot.convert(ref_cmd_start + ref_offset - 1)) // FIXME Command.decode_range
    68                                   snapshot.convert(ref_cmd_start + ref_cmd.decode(ref_offset)))
    71                               case None => null
    69                               case None => null
    72                             }
    70                             }
    73                           case None => null
    71                           case None => null
    74                         }
    72                         }
    75                       case _ => null
    73                       case _ => null
    76                     }
    74                     }
    77                 }
    75                 }
    78 //}}}
       
    79             }).head.info
    76             }).head.info
    80           case None => null
    77           case None => null
    81         }
    78         }
    82       case None => null
    79       case None => null
    83     }
    80     }