src/Pure/PIDE/document.scala
changeset 70780 034742453594
parent 70716 a8afe8eb3529
child 70986 d8a7df9fdd03
--- a/src/Pure/PIDE/document.scala	Tue Oct 01 20:21:30 2019 +0200
+++ b/src/Pure/PIDE/document.scala	Wed Oct 02 14:45:37 2019 +0200
@@ -897,16 +897,18 @@
       } yield (id -> command)).toMap
     }
 
-    def command_state_eval(version: Version, command: Command): Option[Command.State] =
+    def command_maybe_consolidated(version: Version, command: Command): Boolean =
     {
       require(is_assigned(version))
       try {
         the_assignment(version).check_finished.command_execs.getOrElse(command.id, Nil) match {
-          case eval_id :: _ => Some(the_dynamic_state(eval_id))
-          case Nil => None
+          case eval_id :: print_ids =>
+            the_dynamic_state(eval_id).maybe_consolidated &&
+            !print_ids.exists(print_id => the_dynamic_state(print_id).consolidating)
+          case Nil => false
         }
       }
-      catch { case _: State.Fail => None }
+      catch { case _: State.Fail => false }
     }
 
     private def command_states_self(version: Version, command: Command)
@@ -992,13 +994,7 @@
 
     def node_maybe_consolidated(version: Version, name: Node.Name): Boolean =
       name.is_theory &&
-      {
-        version.nodes(name).commands.reverse.iterator.forall(command =>
-          command_state_eval(version, command) match {
-            case None => false
-            case Some(st) => st.maybe_consolidated
-          })
-      }
+      version.nodes(name).commands.reverse.iterator.forall(command_maybe_consolidated(version, _))
 
     def node_consolidated(version: Version, name: Node.Name): Boolean =
       !name.is_theory ||