tuned;
authorwenzelm
Fri, 23 Dec 2016 11:53:31 +0100
changeset 64662 5a2c15faf89c
parent 64661 84aea854dc3c
child 64663 4c9fb4d4bca3
tuned;
src/Pure/General/position.scala
src/Tools/jEdit/src/jedit_editor.scala
--- a/src/Pure/General/position.scala	Fri Dec 23 11:36:41 2016 +0100
+++ b/src/Pure/General/position.scala	Fri Dec 23 11:53:31 2016 +0100
@@ -64,7 +64,7 @@
       }
   }
 
-  object Id_Offset0
+  object Item_Id
   {
     def unapply(pos: T): Option[(Long, Symbol.Offset)] =
       pos match {
@@ -73,7 +73,7 @@
       }
   }
 
-  object Def_Id_Offset0
+  object Item_Def_Id
   {
     def unapply(pos: T): Option[(Long, Symbol.Offset)] =
       pos match {
@@ -82,6 +82,28 @@
       }
   }
 
+  object Item_File
+  {
+    def unapply(pos: T): Option[(String, Int, Symbol.Offset)] =
+      pos match {
+        case Line_File(line, name) =>
+          val offset = Position.Offset.unapply(pos) getOrElse 0
+          Some((name, line, offset))
+        case _ => None
+      }
+  }
+
+  object Item_Def_File
+  {
+    def unapply(pos: T): Option[(String, Int, Symbol.Offset)] =
+      pos match {
+        case Def_Line_File(line, name) =>
+          val offset = Position.Def_Offset.unapply(pos) getOrElse 0
+          Some((name, line, offset))
+        case _ => None
+      }
+  }
+
   object Identified
   {
     def unapply(pos: T): Option[(Long, Symbol.Text_Chunk.Name)] =
--- a/src/Tools/jEdit/src/jedit_editor.scala	Fri Dec 23 11:36:41 2016 +0100
+++ b/src/Tools/jEdit/src/jedit_editor.scala	Fri Dec 23 11:53:31 2016 +0100
@@ -315,7 +315,7 @@
     text_offset: Text.Offset, pos: Position.T): Boolean =
   {
     pos match {
-      case Position.Id_Offset0(id, offset) if offset > 0 =>
+      case Position.Item_Id(id, offset) if offset > 0 =>
         snapshot.state.find_command(snapshot.version, id) match {
           case Some((node, command)) if snapshot.version.nodes(command.node_name) eq node =>
             node.command_start(command) match {
@@ -331,10 +331,9 @@
   def hyperlink_position(focus: Boolean, snapshot: Document.Snapshot, pos: Position.T)
       : Option[Hyperlink] =
     pos match {
-      case Position.Line_File(line, name) =>
-        val offset = Position.Offset.unapply(pos) getOrElse 0
+      case Position.Item_File(name, line, offset) =>
         hyperlink_source_file(focus, name, line, offset)
-      case Position.Id_Offset0(id, offset) =>
+      case Position.Item_Id(id, offset) =>
         hyperlink_command_id(focus, snapshot, id, offset)
       case _ => None
     }
@@ -342,10 +341,9 @@
   def hyperlink_def_position(focus: Boolean, snapshot: Document.Snapshot, pos: Position.T)
       : Option[Hyperlink] =
     pos match {
-      case Position.Def_Line_File(line, name) =>
-        val offset = Position.Def_Offset.unapply(pos) getOrElse 0
+      case Position.Item_Def_File(name, line, offset) =>
         hyperlink_source_file(focus, name, line, offset)
-      case Position.Def_Id_Offset0(id, offset) =>
+      case Position.Item_Def_Id(id, offset) =>
         hyperlink_command_id(focus, snapshot, id, offset)
       case _ => None
     }