clarified notion of Command.proper_range (according to Token.is_proper), especially relevant for Active.try_replace_command, to avoid loosing subsequent comments accidentally;
authorwenzelm
Fri, 25 Jan 2013 13:09:34 +0100
changeset 51048 123be08eed88
parent 51047 2ad5c46bcd04
child 51049 0b48d00aba8f
clarified notion of Command.proper_range (according to Token.is_proper), especially relevant for Active.try_replace_command, to avoid loosing subsequent comments accidentally; reverted f3588e59aeaa accordingly;
src/Pure/Isar/proof.ML
src/Pure/Isar/token.scala
src/Pure/PIDE/command.scala
--- a/src/Pure/Isar/proof.ML	Thu Jan 24 21:18:30 2013 +0100
+++ b/src/Pure/Isar/proof.ML	Fri Jan 25 13:09:34 2013 +0100
@@ -1031,8 +1031,8 @@
 local
 
 fun skipped_proof state =
-  Context_Position.report_text (context_of state) (Position.thread_data ())
-    Markup.bad "Skipped proof";
+  Context_Position.if_visible (context_of state) Output.report
+    (Markup.markup Markup.bad "Skipped proof");
 
 in
 
--- a/src/Pure/Isar/token.scala	Thu Jan 24 21:18:30 2013 +0100
+++ b/src/Pure/Isar/token.scala	Fri Jan 25 13:09:34 2013 +0100
@@ -89,6 +89,7 @@
   def is_text: Boolean = is_xname || kind == Token.Kind.VERBATIM
   def is_space: Boolean = kind == Token.Kind.SPACE
   def is_comment: Boolean = kind == Token.Kind.COMMENT
+  def is_improper: Boolean = is_space || is_comment
   def is_proper: Boolean = !is_space && !is_comment
   def is_error: Boolean = kind == Token.Kind.ERROR
   def is_unparsed: Boolean = kind == Token.Kind.UNPARSED
--- a/src/Pure/PIDE/command.scala	Thu Jan 24 21:18:30 2013 +0100
+++ b/src/Pure/PIDE/command.scala	Fri Jan 25 13:09:34 2013 +0100
@@ -209,7 +209,7 @@
   val range: Text.Range = Text.Range(0, length)
 
   val proper_range: Text.Range =
-    Text.Range(0, (length /: span.reverse.iterator.takeWhile(_.is_space))(_ - _.source.length))
+    Text.Range(0, (length /: span.reverse.iterator.takeWhile(_.is_improper))(_ - _.source.length))
 
   def source(range: Text.Range): String = source.substring(range.start, range.stop)