From c3a2805d221ef1a8555303ad6232fbfe7480cf0c Mon Sep 17 00:00:00 2001 From: Matt Keenan Date: Tue, 26 Nov 2024 11:10:11 -0500 Subject: [PATCH] replace nth with nth_opt in stepper selection --- src/haz3lweb/view/StepperView.re | 15 +++++++++------ src/haz3lweb/www/style/dynamics.css | 4 ++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/haz3lweb/view/StepperView.re b/src/haz3lweb/view/StepperView.re index c28292d9b8..9d288aee84 100644 --- a/src/haz3lweb/view/StepperView.re +++ b/src/haz3lweb/view/StepperView.re @@ -345,16 +345,18 @@ module Selection = { Cursor.( switch (selection) { | A(n, editor_selection) => - let a: Model.a = mr.history |> Aba.get_as |> List.nth(_, n); + let a: option(Model.a) = + mr.history |> Aba.get_as |> List.nth_opt(_, n); switch (a) { - | Calculated(a) => + | Some(Calculated(a)) => let+ x = StepperEditor.Selection.get_cursor_info( ~selection=editor_selection, a.editor |> Calc.get_value, ); Update.StepperEditor(n, x); - | Pending => empty + | None + | Some(Pending) => empty }; } ); @@ -363,9 +365,9 @@ module Selection = { let handle_key_event = (~selection: t, ~event, mr: Model.t): option(Update.t) => { let A(i, s) = selection; - let a: Model.a = mr.history |> Aba.get_as |> List.nth(_, i); + let a: option(Model.a) = mr.history |> Aba.get_as |> List.nth_opt(_, i); switch (a) { - | Calculated(a) => + | Some(Calculated(a)) => let+ x = StepperEditor.Selection.handle_key_event( ~selection=s, @@ -373,7 +375,8 @@ module Selection = { event, ); Update.StepperEditor(i, x); - | Pending => None + | Some(Pending) + | None => None }; }; }; diff --git a/src/haz3lweb/www/style/dynamics.css b/src/haz3lweb/www/style/dynamics.css index 6cf59dcca2..8baba93ec0 100644 --- a/src/haz3lweb/www/style/dynamics.css +++ b/src/haz3lweb/www/style/dynamics.css @@ -323,6 +323,10 @@ svg.tile-next-step { filter: drop-shadow(1px 1px var(--G2)); } +svg.tile-taken-step { + filter: drop-shadow(1px 1px var(--BR1)); +} + .cell-result .code { pointer-events: none; } \ No newline at end of file