Skip to content

Commit

Permalink
missed a spot
Browse files Browse the repository at this point in the history
  • Loading branch information
dm0n3y committed Aug 23, 2024
1 parent 98334b4 commit 48fab12
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/core/editor/Modify.re
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ let rec remold = (~fill=Cell.dirty, ctx: Ctx.t): (Cell.t, Ctx.t) => {
};
};

let finalize = (~fill=Cell.dirty, ctx: Ctx.t): Zipper.t => {
let (remolded, ctx) = remold(~fill, ctx);
let (l, r) = Ctx.(face(~side=L, ctx), face(~side=R, ctx));
let repadded = Cell.repad(~l, remolded, ~r);
Zipper.unzip_exn(repadded, ~ctx);
};

let extend = (~side=Dir.R, s: string, tok: Token.t) =>
switch (tok.mtrl) {
| Space(_)
Expand Down Expand Up @@ -234,11 +241,8 @@ let try_expand = (s: string, z: Zipper.t): option(Zipper.t) => {
let ctx = z.ctx |> Ctx.push(~onto=L, Token.space());
return(Zipper.mk(ctx));
| Molded(Neq(dn)) =>
let (cell, ctx) =
Ctx.cons((dn, up), tl)
|> Ctx.push(~onto=L, Token.space())
|> remold(~fill=Cell.point(~dirty=true, Focus));
return(Zipper.unzip_exn(cell, ~ctx));
let ctx = Ctx.cons((dn, up), tl) |> Ctx.push(~onto=L, Token.space());
return(finalize(~fill=Cell.point(~dirty=true, Focus), ctx));
| Molded(Eq(l)) =>
let (dn, up) = ([l], Slope.cat(up, Bound.to_list(r)));
let ctx = Ctx.Tl.rest(tl) |> Ctx.map_hd(Frame.Open.cat((dn, up)));
Expand Down Expand Up @@ -316,13 +320,6 @@ let delete_toks =
|> Chain.mapi_link(i => Token.unmold(~relabel=i - 1 / 2 == n - 1));
};

let finalize = (~fill=Cell.dirty, ctx: Ctx.t): Zipper.t => {
let (remolded, ctx) = remold(~fill, ctx);
let (l, r) = Ctx.(face(~side=L, ctx), face(~side=R, ctx));
let repadded = Cell.repad(~l, remolded, ~r);
Zipper.unzip_exn(repadded, ~ctx);
};

// delete_sel clears the textual content of the current selection (doing nothing if
// the selection is empty). this entails dropping all of the zigg's cells and
// remelding the zigg's tokens as empty ghosts onto (the left side of) the ctx. in
Expand Down

0 comments on commit 48fab12

Please sign in to comment.