Skip to content

Commit

Permalink
thunk printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Negabinary committed Nov 13, 2024
1 parent 741bd85 commit 0702e60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/haz3lweb/app/Cursor.re
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type cursor('update) = {
info: option(Haz3lcore.Info.t),
selected_text: option(string),
selected_text: option(unit => string),
editor: option(Haz3lcore.Editor.t),
editor_action: Haz3lcore.Action.t => option('update),
undo_action: option('update),
Expand Down
8 changes: 6 additions & 2 deletions src/haz3lweb/app/Page.re
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,15 @@ module View = {
Effect.Ignore;
}),
Attr.on_copy(_ => {
JsUtil.copy(cursor.selected_text |> Option.value(~default=""));
JsUtil.copy(
(cursor.selected_text |> Option.value(~default=() => ""))(),
);
Effect.Ignore;
}),
Attr.on_cut(_ => {
JsUtil.copy(cursor.selected_text |> Option.value(~default=""));
JsUtil.copy(
(cursor.selected_text |> Option.value(~default=() => ""))(),
);
Option.map(
inject,
Selection.handle_key_event(
Expand Down
2 changes: 1 addition & 1 deletion src/haz3lweb/app/editors/code/CodeWithStatics.re
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Model = {
let get_cursor_info = (model: t): Cursor.cursor(Action.t) => {
info: Indicated.ci_of(model.editor.state.zipper, model.statics.info_map),
selected_text:
Some(Printer.to_string_selection(model.editor.state.zipper)),
Some(() => Printer.to_string_selection(model.editor.state.zipper)),
editor: Some(model.editor),
editor_action: x => Some(x),
undo_action: None,
Expand Down

0 comments on commit 0702e60

Please sign in to comment.