This commit is contained in:
cqc
2024-07-28 15:58:37 -05:00
parent f8525ac35f
commit c604345886
2 changed files with 132 additions and 91 deletions

View File

@ -152,43 +152,58 @@ let main =
(String "#use \"topfind\";;\n#list;;#require \"lwt\";;")); *)
(* toplevel execution binding *)
Ui.(
update_bindings ui
Event.(
fun a ->
a
|> adds
[
[
Key (Press, X, [ Control ]);
Key (Press, E, [ Control ]);
];
]
[
Custom
( "toplevel_execute",
fun () ->
TextBuffer.peek tb_init >>= fun _str ->
(*Toploop.use_input out_ppf (String str)
|> F.epr "Toploop.use_input=%b@."; *)
Lwt.return_unit );
]));
append_bindings ui
(Lwd.return
Event.
[
pack Fun.id
(empty
|> adds
[
[
Key (Press, X, [ Control ]);
Key (Press, E, [ Control ]);
];
]
[
Custom
( "toplevel_execute",
fun () ->
TextBuffer.peek tb_init >>= fun _str ->
(*Toploop.use_input out_ppf (String str)
|> F.epr "Toploop.use_input=%b@."; *)
Lwt.return_unit );
]);
]));
WindowManager.make ui
(Lwd.var
(`T
( `Y,
[
(`TextEdit (TextEdit.multiline ui to_init), `Ratio 0.333);
(`TextEdit (TextEdit.multiline ui tb_init), `Ratio 0.5);
(`TextEdit (TextEdit.multiline ui to_init), `Ratio 1.0);
] )))
WindowManager.
[
{
t = `TextEdit (TextEdit.multiline ui to_init);
dim = `Ratio 0.333;
bindings = [];
};
{
t = `TextEdit (TextEdit.multiline ui tb_init);
dim = `Ratio 0.5;
bindings = [];
};
{
t = `TextEdit (TextEdit.multiline ui to_init);
dim = `Ratio 1.0;
bindings = [];
};
] )))
>>= fun page ->
let page_root = Lwd.observe page in
let bindings =
ui.bindings |> Lwd.get |> Lwd.observe |> Lwd.quick_sample |> snd
in
F.epr "Bindings:@.%a" Ui.pp_bindings bindings;
let bindings = ui.bindings |> Lwd.observe |> Lwd.quick_sample in
F.epr "Bindings:@.";
List.iter (fun bs -> F.epr "%a" Ui.pp_pack bs) bindings;
F.pr "oplevel.ml: entering drawing loop@.";
let period_min = 1.0 /. 30. in