From 7b39c434946787956386c3b594570acbc263fc1b Mon Sep 17 00:00:00 2001 From: Matt Keenan Date: Wed, 21 Aug 2024 13:31:08 -0400 Subject: [PATCH] Fix selections printing as buffer --- src/haz3lweb/app/editors/code/Code.re | 25 ------------------- .../app/editors/code/CodeWithStatics.re | 9 +++++-- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/haz3lweb/app/editors/code/Code.re b/src/haz3lweb/app/editors/code/Code.re index 818bbae1ba..ee0cd2b564 100644 --- a/src/haz3lweb/app/editors/code/Code.re +++ b/src/haz3lweb/app/editors/code/Code.re @@ -186,28 +186,3 @@ let of_hole = (~globals: Globals.t, ~measured, g: Grout.t) => mold: Mold.of_grout(g, Any), }, ); - -let view = - ( - ~globals: Globals.t, - ~sort: Sort.t, - ~settings: Settings.t, - ~statics: CachedStatics.t, - z: Zipper.t, - {syntax: {measured, segment, holes, selection_ids, _}, _}: Editor.t, - ) - : Node.t => { - module Text = - Text({ - let map = measured; - let settings = settings; - let info_map = statics.info_map; - }); - let buffer_ids = Selection.is_buffer(z.selection) ? selection_ids : []; - let code = Text.of_segment(buffer_ids, false, sort, segment); - let holes = List.map(of_hole(~measured, ~globals), holes); - div( - ~attrs=[Attr.class_("code")], - [span_c("code-text", code), ...holes], - ); -}; diff --git a/src/haz3lweb/app/editors/code/CodeWithStatics.re b/src/haz3lweb/app/editors/code/CodeWithStatics.re index ac5352985b..1951ce1742 100644 --- a/src/haz3lweb/app/editors/code/CodeWithStatics.re +++ b/src/haz3lweb/app/editors/code/CodeWithStatics.re @@ -69,7 +69,12 @@ module View = { (~globals, ~overlays: list(Node.t)=[], ~sort=Sort.root, model: Model.t) => { let { statics: {info_map, _}, - editor: {syntax: {measured, selection_ids, segment, holes, _}, _}, + editor: + { + syntax: {measured, selection_ids, segment, holes, _}, + state: {zipper: z, _}, + _, + }, _, }: Model.t = model; let code_text_view = @@ -77,7 +82,7 @@ module View = { ~globals, ~sort, ~measured, - ~buffer_ids=selection_ids, + ~buffer_ids=Selection.is_buffer(z.selection) ? selection_ids : [], ~segment, ~holes, ~info_map,