Skip to content

Commit

Permalink
replace nth with nth_opt in stepper selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Negabinary committed Nov 26, 2024
1 parent 856323e commit c3a2805
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/haz3lweb/view/StepperView.re
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
);
Expand All @@ -363,17 +365,18 @@ 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,
a.editor |> Calc.get_value,
event,
);
Update.StepperEditor(i, x);
| Pending => None
| Some(Pending)
| None => None
};
};
};
Expand Down
4 changes: 4 additions & 0 deletions src/haz3lweb/www/style/dynamics.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit c3a2805

Please sign in to comment.