command property: offset relative to start of command
authorimmler@in.tum.de
Sun, 07 Dec 2008 15:01:37 +0100
changeset 34396 de809360c51d
parent 34395 287f3ecdfc2a
child 34397 86daaf5db016
command property: offset relative to start of command
src/Tools/jEdit/src/prover/Command.scala
src/Tools/jEdit/src/prover/Prover.scala
--- a/src/Tools/jEdit/src/prover/Command.scala	Tue Dec 02 15:25:24 2008 +0100
+++ b/src/Tools/jEdit/src/prover/Command.scala	Sun Dec 07 15:01:37 2008 +0100
@@ -73,6 +73,7 @@
     val cand_asset = cand.getUserObject.asInstanceOf[RelativeAsset]
     val c_start = cand_asset.rel_start
     val c_end = cand_asset.rel_end
+    System.err.println(c_start - n_start + " " + (c_end - n_end))
     return c_start >= n_start && c_end <= n_end
   }
 
@@ -105,18 +106,20 @@
     var markup_begin = -1
     var markup_end = -1
     for((n, a) <- attr) {
-      if(n.equals("offset")) markup_begin = Int.unbox(java.lang.Integer.valueOf(a)) - first.start
-      if(n.equals("end_offset")) markup_end = Int.unbox(java.lang.Integer.valueOf(a)) - first.start
+      if(n.equals("offset")) markup_begin = Int.unbox(java.lang.Integer.valueOf(a)) - 1
+      if(n.equals("end_offset")) markup_end = Int.unbox(java.lang.Integer.valueOf(a)) - 1
     }
     if(markup_begin > -1 && markup_end > -1){
       statuses = new Status(markup_info, markup_begin, markup_end) :: statuses
-      val content = Plugin.plugin.prover.document.getContent(this).substring(markup_begin, markup_end)
-      val asset = new RelativeAsset(this, markup_begin, markup_end, markup_info, content)
+      val markup_content = content.substring(markup_begin, markup_end)
+      val asset = new RelativeAsset(this, markup_begin, markup_end, markup_info, markup_content)
       val new_node = new DefaultMutableTreeNode(asset)
       insert_node(new_node, root_node)
     }
   }
 
+  def content = Plugin.plugin.prover.document.getContent(this)
+
   def next = if (last.next != null) last.next.command else null
   def previous = if (first.previous != null) first.previous.command else null
 
--- a/src/Tools/jEdit/src/prover/Prover.scala	Tue Dec 02 15:25:24 2008 +0100
+++ b/src/Tools/jEdit/src/prover/Prover.scala	Sun Dec 07 15:01:37 2008 +0100
@@ -174,7 +174,7 @@
     
     val props = new Properties()
     props.setProperty("id", cmd.idString)
-    props.setProperty("offset", Integer.toString(cmd.first.start))
+    props.setProperty("offset", Integer.toString(1))
 
     val content = converter.encode(document.getContent(cmd))
     process.output_sync("Isar.command "