<property name="spacing">0</property>
<child>
- <widget class="GtkToolbar" id="toolbar13">
+ <widget class="GtkToolbar" id="buttonsToolbar">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
source_buffer#place_cursor
(source_buffer#get_iter_at_mark (`NAME "locked"))
in
+ let lock_world _ =
+ main#buttonsToolbar#misc#set_sensitive false;
+ source_view#set_editable false
+ in
+ let unlock_world _ =
+ main#buttonsToolbar#misc#set_sensitive true;
+ source_view#set_editable true
+ in
let advance _ = (MatitaScript.instance ())#advance (); cursor () in
let retract _ = (MatitaScript.instance ())#retract (); cursor () in
let top _ = (MatitaScript.instance ())#goto `Top (); cursor () in
let bottom _ = (MatitaScript.instance ())#goto `Bottom (); cursor () in
let jump _ = (MatitaScript.instance ())#goto `Cursor (); cursor () in
+ let locker f =
+ fun () ->
+ lock_world ();
+ try f ();unlock_world () with exc -> unlock_world (); raise exc
+ in
+ let advance = locker advance in
+ let retract = locker retract in
+ let top = locker top in
+ let bottom = locker bottom in
+ let jump = locker jump in
let connect_key sym f =
connect_key self#main#mainWinEventBox#event
~modifiers:[`CONTROL] ~stop:true sym f;
set_star self#ppFilename false
method goto (pos: [`Top | `Bottom | `Cursor]) () =
+ let getpos _ = buffer#get_iter_at_mark (`MARK locked_mark) in
match pos with
| `Top -> self#goto_top; self#notify
| `Bottom ->
(try
- let getpos _ = buffer#get_iter_at_mark (`MARK locked_mark) in
let rec dowhile pos =
self#_advance ();
if pos#compare (getpos ()) < 0 then
| `Cursor ->
let locked_iter () = buffer#get_iter_at_mark (`NAME "locked") in
let cursor_iter () = buffer#get_iter_at_mark `INSERT in
- let rec forward_until_cursor () = (* go forward until locked > cursor *)
- self#_advance ();
- if (locked_iter ())#compare (cursor_iter ()) < 0 then
- forward_until_cursor ()
+ let forward_until_cursor () = (* go forward until locked > cursor *)
+ let rec aux oldpos =
+ self#_advance ();
+ if (locked_iter ())#compare (cursor_iter ()) < 0 &&
+ oldpos#compare (getpos ()) < 0
+ then
+ aux (getpos ())
+ in
+ aux (getpos ())
in
let rec back_until_cursor () = (* go backward until locked < cursor *)
self#_retract ();