From 0cfa3f9266368beb3eae2ba3472504645f93e867 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 4 Jul 2005 16:39:19 +0000 Subject: [PATCH] notification of changes is now done only at the very end of the four main actions: goto, reset, advance and retract. --- helm/matita/matitaScript.ml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/helm/matita/matitaScript.ml b/helm/matita/matitaScript.ml index 4f7027d61..94cedf29b 100644 --- a/helm/matita/matitaScript.ml +++ b/helm/matita/matitaScript.ml @@ -391,10 +391,15 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; method advance ?statement () = try - self#_advance ?statement () + self#_advance ?statement (); + self#notify with Margin -> () - method retract () = try self#_retract () with Margin -> () + method retract () = + try + self#_retract (); + self#notify + with Margin -> () method private getFuture = buffer#get_text ~start:(buffer#get_iter_at_mark (`MARK locked_mark)) @@ -415,7 +420,9 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; buffer#move_mark mark ~where:new_mark_pos; buffer#apply_tag locked_tag ~start:buffer#start_iter ~stop:new_mark_pos; buffer#move_mark `INSERT old_insert; - self#notify + match self#status.proof_status with + Incomplete_proof (_,goal) -> self#setGoal goal + | _ -> () val mutable observers = [] @@ -457,19 +464,19 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; statements <- []; history <- [ init ]; userGoal <- ~-1; - self#notify; buffer#remove_tag locked_tag ~start:buffer#start_iter ~stop:buffer#end_iter; buffer#move_mark (`MARK locked_mark) ~where:buffer#start_iter method reset () = self#goto_top; - buffer#delete ~start:buffer#start_iter ~stop:buffer#end_iter + buffer#delete ~start:buffer#start_iter ~stop:buffer#end_iter; + self#notify method goto (pos: [`Top | `Bottom | `Cursor]) () = match pos with - | `Top -> self#goto_top + | `Top -> self#goto_top; self#notify | `Bottom -> - (try while true do self#_advance () done with Margin -> ()) + (try while true do self#_advance () done; self#notify with Margin -> ()) | `Cursor -> let locked_iter () = buffer#get_iter_at_mark (`NAME "locked") in let cursor_iter () = buffer#get_iter_at_mark `INSERT in @@ -486,9 +493,9 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; let cmp = (locked_iter ())#compare (cursor_iter ()) in (try if cmp < 0 then (* locked < cursor *) - forward_until_cursor () + (forward_until_cursor (); self#notify) else if cmp > 0 then (* locked > cursor *) - back_until_cursor () + (back_until_cursor (); self#notify) else (* cursor = locked *) () with Margin -> ()) -- 2.39.2