Skip to content

Commit

Permalink
fix #45
Browse files Browse the repository at this point in the history
  • Loading branch information
dm0n3y committed Nov 8, 2024
1 parent d4cc817 commit 4c8b67e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/core/editor/Move.re
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ let hole = (d: Dir.t, z: Zipper.t): option(Zipper.t) => {
switch (Zipper.cursor_site(z)) {
| (Select(_), _) => hstep(d, z)
| (Point(site), ctx) =>
open Options.Syntax;
let z =
switch (d) {
| L => z
Expand All @@ -135,7 +134,7 @@ let hole = (d: Dir.t, z: Zipper.t): option(Zipper.t) => {
|> Options.get_exn(Zipper.Bug__lost_cursor)
|> Path.Cursor.get_point
|> Option.get;
let+ (path, _) =
let path =
c.marks.obligs
|> Path.Map.filter((_, mtrl: Mtrl.T.t) => mtrl != Space(Unmolded))
|> Dir.pick(
Expand All @@ -144,8 +143,13 @@ let hole = (d: Dir.t, z: Zipper.t): option(Zipper.t) => {
Path.Map.find_last_opt(p => Path.lt(normal(p), car.path)),
Path.Map.find_first_opt(p => Path.gt(normal(p), car.path)),
),
);
c |> Cell.put_cursor(Point(Caret.focus(path))) |> Zipper.unzip_exn;
)
|> Option.map(fst)
|> Options.get(() => Cell.end_path(~side=d, c));
c
|> Cell.put_cursor(Point(Caret.focus(path)))
|> Zipper.unzip_exn
|> Option.some;
};
};

Expand Down
4 changes: 2 additions & 2 deletions src/core/grammar/Label.re
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ let is_complete = text =>
true
| Const(_, c) => String.equal(c, text);

let complete =
let complete = text =>
fun
| Id_lower
| Id_upper
| Int_lit
| Float_lit => None
| Const(_, c) => Some(c);
| Const(_, c) => String.equal(c, text) ? None : Some(c);

// beware calling this with the text of partial tokens
let oblig = text =>
Expand Down
2 changes: 1 addition & 1 deletion src/core/structure/Token.re
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module Molded = {
| Space(_)
| Grout(_) => None
| Tile((lbl, _)) =>
Label.complete(lbl) |> Option.map(text => {...tok, text})
Label.complete(tok.text, lbl) |> Option.map(text => {...tok, text})
};

let cat = (l: t, ~caret=?, r: t) => {
Expand Down

0 comments on commit 4c8b67e

Please sign in to comment.