Skip to content

Commit

Permalink
Fix selection in steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Negabinary committed Oct 11, 2024
1 parent d69d4d0 commit 0d6d6c3
Show file tree
Hide file tree
Showing 6 changed files with 339 additions and 186 deletions.
9 changes: 1 addition & 8 deletions src/haz3lcore/zipper/Editor.re
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ module Update = {
)
: Action.Result.t(Model.t) => {
open Result.Syntax;
print_endline("1");
// 1. Clear the autocomplete buffer if relevant
let state =
settings.assist && settings.statics && a != Buffer(Accept)
Expand All @@ -171,12 +170,10 @@ module Update = {
syntax;
};

print_endline("2");
// 2. Add to undo history
let history =
Action.is_historic(a) ? History.add(a, state, history) : history;

print_endline("3");
// 3. Record target column if moving up/down
let col_target =
switch (a) {
Expand All @@ -190,7 +187,6 @@ module Update = {
};
let state = {...state, col_target};

print_endline("4");
// 4. Update the zipper
let+ zipper =
Perform.go_z(
Expand All @@ -201,7 +197,6 @@ module Update = {
state.zipper,
);

print_endline("5");
// Recombine
Model.{
state: {
Expand Down Expand Up @@ -248,7 +243,6 @@ module Update = {
new_statics,
{syntax, state, history}: Model.t,
) => {
print_endline("6");
// 1. Recalculate the autocomplete buffer if necessary
let zipper =
if (settings.assist && settings.statics && is_edited) {
Expand All @@ -267,12 +261,11 @@ module Update = {
} else {
state.zipper;
};
print_endline("7");
// 2. Recalculate syntax cache
let syntax = is_edited ? CachedSyntax.mark_old(syntax) : syntax;

let syntax = CachedSyntax.calculate(zipper, new_statics.info_map, syntax);
print_endline("8");

// Recombine
Model.{
history,
Expand Down
3 changes: 3 additions & 0 deletions src/haz3lweb/app/editors/result/EvalResult.re
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ module Selection = {
) =>
CodeSelectable.Selection.handle_key_event(~selection, editor, event)
|> Option.map(x => Update.EvalEditorAction(x))
| (Stepper(selection), Stepper(s)) =>
Stepper.Selection.handle_key_event(~selection, s, ~event)
|> Option.map(x => Update.StepperAction(x))
| (_, Evaluation(_)) => None
| (_, Stepper(_)) => None
};
Expand Down
Loading

0 comments on commit 0d6d6c3

Please sign in to comment.