Skip to content

Commit

Permalink
fix #36
Browse files Browse the repository at this point in the history
  • Loading branch information
dm0n3y committed Feb 16, 2025
1 parent e9cc1de commit b144e0e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/core/editor/Tab.re
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ let complete_face = (site: Zipper.Site.t, ctx: Ctx.t) =>
complete(R);
};

let perform = (d: Dir.t, z: Zipper.t): option(Zipper.t) =>
let modified = ref(false);

let perform = (d: Dir.t, z: Zipper.t): option(Zipper.t) => {
modified := true;
switch (Zipper.cursor_site(z)) {
| (Select(_), _) => Move.hstep(d, z)
| (Select(_), _) =>
modified := false;
Some(Move.unselect(~toward=d, z));
| (Point(site), ctx) =>
open Options.Syntax;
// P.log("--- Tab.perform/Point");
Expand All @@ -33,6 +38,7 @@ let perform = (d: Dir.t, z: Zipper.t): option(Zipper.t) =>
Modify.try_expand(" ", z);
};
// otherwise jump to next obligation
modified := false;
let c = Zipper.zip(~save_cursor=true, z);
// P.show("c", Cell.show(c));
let normal = Zipper.normalize(~cell=c);
Expand All @@ -59,3 +65,4 @@ let perform = (d: Dir.t, z: Zipper.t): option(Zipper.t) =>
|> Zipper.unzip_exn
|> Option.some;
};
};
11 changes: 9 additions & 2 deletions src/web/model/History.re
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ let can_undo = ((_, after): t) => Chain.Affix.is_empty(after);
// last_attempt: Some(JsUtil.timestamp()),
// };
// };
let do_ = (a: Edit.t, z: Zipper.t, (pre, _): t) =>
Chain.Affix.(link(a, z, pre), empty);
let do_ = (a: Edit.t, z: Zipper.t, (pre, _) as h: t) =>
switch (a) {
| Tab(_) when ! Tab.modified^ => h
| Move(_)
| Select(_) => h
| Tab(_)
| Insert(_)
| Delete(_) => Chain.Affix.(link(a, z, pre), empty)
};

// let escaped = (history: t) => {
// ...history,
Expand Down

0 comments on commit b144e0e

Please sign in to comment.