summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index cf3d5128..e92f9623 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -123,9 +123,6 @@ pub const Turn = struct {
/// Bumped each time a language server's answer (or its lack) is taken
/// in (`lspResponse`): a write that asked one waits for this.
lsp_answers: u64 = 0,
- /// Bumped each time an Edit's commands (`< | >`) have answered and the
- /// Edit is done, or failed (edit_cmd.zig): a write that ran one waits.
- edit_answers: u64 = 0,
/// All of the above, and `out` reaching zero.
settled: std.Io.Condition = .init,
@@ -223,15 +220,6 @@ pub const Turn = struct {
while (t.lsp_answers == answers) t.settled.wait(t.io.?, &t.mutex) catch return;
}
- pub fn editAnswered(t: *Turn) void {
- t.edit_answers +%= 1;
- const io = t.io orelse return;
- t.settled.broadcast(io);
- }
-
- pub fn awaitEdit(t: *Turn, answers: u64) void {
- while (t.edit_answers == answers) t.settled.wait(t.io.?, &t.mutex) catch return;
- }
pub fn awaitRestored(t: *Turn, restores: u64) void {
while (t.restores == restores) t.settled.wait(t.io.?, &t.mutex) catch return;
@@ -5918,6 +5906,12 @@ pub const Pardes = struct {
/// that changes a pane costs a frame, which is why a round trip on a
/// local socket costs microseconds and not a vsync.
pub fn serveFs(p: *Pardes, req: ctlfs.Req) ctlfs.Reply {
+ // The held write of an Edit whose commands run, asked again by a
+ // retry of its park: still waiting, or its answer, never run twice.
+ if (p.fs.edit_hold) |*h| if (h.names(req)) {
+ if (!h.done) return .{ .tag = req.tag, .status = .again };
+ return filesystem.EditHold.answer(&p.fs);
+ };
defer panes.File.syncTwins(p);
if (!ctlfs.changesPane(p, req)) return ctlfs.handle(p, req);
// An address, a limit or the mark flag is nothing drawn: a script's
@@ -5928,7 +5922,7 @@ pub const Pardes = struct {
look.cancelLookHover(p);
p.fs.serving = true;
p.fs.lsp_answer_at = null;
- p.fs.edit_answer_at = null;
+ p.fs.edit_started = false;
const reply = ctlfs.handle(p, req);
p.fs.serving = false;
// The one-failure rule is a write's: a refused open (its OTRUNC's