ignore improper tokens to avoid ambiguity of Range.touches (assuming that relevant tokens are separated properly);
authorwenzelm
Tue, 21 Oct 2014 21:20:45 +0200
changeset 58756 eb5d0c58564d
parent 58755 fc822ca2428a
child 58757 7f4924f23158
ignore improper tokens to avoid ambiguity of Range.touches (assuming that relevant tokens are separated properly);
src/Tools/jEdit/src/structure_matching.scala
--- a/src/Tools/jEdit/src/structure_matching.scala	Tue Oct 21 21:02:36 2014 +0200
+++ b/src/Tools/jEdit/src/structure_matching.scala	Tue Oct 21 21:20:45 2014 +0200
@@ -45,10 +45,12 @@
           val limit = PIDE.options.value.int("jedit_structure_limit") max 0
 
           def iterator(line: Int, lim: Int = limit): Iterator[Text.Info[Token]] =
-            Token_Markup.line_token_iterator(syntax, buffer, line, line + lim)
+            Token_Markup.line_token_iterator(syntax, buffer, line, line + lim).
+              filter(_.info.is_proper)
 
           def rev_iterator(line: Int, lim: Int = limit): Iterator[Text.Info[Token]] =
-            Token_Markup.line_token_reverse_iterator(syntax, buffer, line, line - lim)
+            Token_Markup.line_token_reverse_iterator(syntax, buffer, line, line - lim).
+              filter(_.info.is_proper)
 
           def caret_iterator(): Iterator[Text.Info[Token]] =
             iterator(caret_line).dropWhile(info => !info.range.touches(caret))
@@ -56,8 +58,8 @@
           def rev_caret_iterator(): Iterator[Text.Info[Token]] =
             rev_iterator(caret_line).dropWhile(info => !info.range.touches(caret))
 
-          iterator(caret_line, 1).find(info => info.range.touches(caret)) match
-          {
+          iterator(caret_line, 1).find(info => info.range.touches(caret))
+          match {
             case Some(Text.Info(range1, tok)) if syntax.command_kind(tok, Keyword.theory_goal) =>
               find_block(
                 syntax.command_kind(_, Keyword.proof_goal),