cursors for real

This commit is contained in:
cqc
2021-07-12 01:57:00 -05:00
parent d7d824b9ba
commit dd40228699

View File

@ -399,11 +399,11 @@ let draw_pp height fpp (s:Display.state) =
(Box2.max !sc.box)};
Printf.printf "out_indent: (n=%d=%0.2fpx) %s\n" n p (str_of_box !sc.box); flush stdout in
let pp = Format.formatter_of_out_functions {out_string; out_flush; out_newline; out_spaces; out_indent;} in
Format.pp_set_tags pp true;
Format.pp_set_formatter_stag_functions pp {
mark_open_stag = (fun s ->
(match s with
| Cursor c -> push @@ fill_box c (Box2.v (Box2.o !sc.box) (P2.v (height *. 0.333) height)) !sc
| Cursor c -> F.epr "mark_open_stag Cursor: %s\n" (str_of_box !sc.box);
push @@ fill_box c (Box2.v (Box2.o !sc.box) (P2.v (height *. 0.333) height)) !sc
| Color_bg c -> push @@ fill_box c !box !sc
| _ -> ()); "");
mark_close_stag = (
@ -412,6 +412,7 @@ let draw_pp height fpp (s:Display.state) =
print_open_stag = (fun _ -> (*"<open_stag>"*) ()); (* TKTKTKTK XXX IT SHOULD BE USING THESE print ONES *)
print_close_stag = (fun _ -> (*"<close_stag>"*) ());
};
Format.pp_set_tags pp true;
let margin = int_of_float ((Box2.w s.box) /. (Text.Font.text_width f " ")) in
let max_indent = margin in
Format.pp_safe_set_geometry pp ~max_indent ~margin;
@ -647,7 +648,7 @@ let draw_textedit (te:textedit) height (s:Display.state) =
let after_cursor = Zed_string.to_utf8 (Zed_rope.to_string zra) in
F.pf pp "> ";
F.text pp before_cursor;
Format.pp_open_stag pp (Cursor (Wall.Color.v 0.1 0.1 0.125 0.5));
Format.pp_open_stag pp (Cursor (Wall.Color.v 0.99 0.99 0.125 0.3));
F.pf pp "";
Format.pp_close_stag pp ();
F.text pp after_cursor; F.pf pp "@.@.";) s