Vi edit mode: cross phrase register support

This commit is contained in:
ZAN DoYe 2020-05-30 09:19:39 +08:00
parent 952f97a460
commit c0109a6da6
1 changed files with 11 additions and 5 deletions

View File

@ -718,6 +718,8 @@ let execute_phrase = Toploop.execute_phrase
| Main loop | | Main loop |
+-----------------------------------------------------------------+ *) +-----------------------------------------------------------------+ *)
let registers= ref LTerm_vi.Vi.Interpret.RegisterMap.empty
let rec read_phrase term = let rec read_phrase term =
Lwt.catch Lwt.catch
(fun () -> (fun () ->
@ -725,7 +727,11 @@ let rec read_phrase term =
(match !UTop.edit_mode with (match !UTop.edit_mode with
| LTerm_editor.Default-> () | LTerm_editor.Default-> ()
| LTerm_editor.Vi as mode-> read_line#set_editor_mode mode); | LTerm_editor.Vi as mode-> read_line#set_editor_mode mode);
read_line#run) let vi_state= read_line#vi_state in
vi_state#set_registers !registers;
read_line#run >>= fun result->
registers:= vi_state#get_registers;
return result)
(function (function
| Sys.Break -> | Sys.Break ->
LTerm.fprintl term "Interrupted." >>= fun () -> LTerm.fprintl term "Interrupted." >>= fun () ->