summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index dc479909..22d5f7a1 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -4792,6 +4792,7 @@ pub const Pardes = struct {
for (p.panes) |slot| if (slot) |pane| p.noteClosed(pane);
p.saveRecent();
p.recent.deinit(p.recentGpa());
+ p.fs.batch.bytes.deinit(p.gpa);
if (p.stand_in) |pane| p.teardownPane(pane);
look.cancelLookHover(p);
if (p.repl_ask) |ask| p.gpa.free(ask.text);
@@ -5081,6 +5082,15 @@ pub const Pardes = struct {
else
"Newcol: no space for a column: this one is too narrow to split");
};
+ // A narrower column wraps long tags onto more rows, which can leave
+ // a pane under its tag and two rows: its column's rows are shared
+ // out again, and where they cannot hold every minimum there is no
+ // new column, as a size too small is refused.
+ for (0..p.ncol) |k| if (!layout.columnAtMinimums(p, k) and !layout.shareColumn(p, k)) {
+ layout.dropColumn(p, c);
+ layout.compute(p);
+ return p.reportFailure(from_id, "Newcol: no space for a column: the panes' tags would not fit");
+ };
tagline.enterHeader(p, c);
}
@@ -5686,6 +5696,8 @@ pub const Pardes = struct {
f(h.ctx, timeout);
}
if (v.now) |clock| p.advance(clock(h.ctx));
+ // What a 9P open wrote in a row goes in once the writes pause.
+ ctlfs.pane.flushPausedBatch(p);
while (p.nextQueued()) |ev| p.update(ev);
while (p.nextEffect()) |e| p.perform(e);
turn.settle();
@@ -5716,14 +5728,21 @@ pub const Pardes = struct {
/// local socket costs microseconds and not a vsync.
pub fn serveFs(p: *Pardes, req: ctlfs.Req) ctlfs.Reply {
if (!ctlfs.changesPane(p, req)) return ctlfs.handle(p, req);
- p.needs_frame = true;
+ // An address, a limit or the mark flag is nothing drawn: a script's
+ // addr write then its close costs no frame between them.
+ const drawn = if (ctlfs.Node.target(req.node)) |t| !(t == .pane and (t.pane.file == .addr or t.pane.file == .limit or t.pane.file == .mark)) else true;
+ if (drawn) p.needs_frame = true;
p.raw_hover_intent = false;
look.cancelLookHover(p);
p.fs.serving = true;
p.fs.lsp_answer_at = null;
const reply = ctlfs.handle(p, req);
p.fs.serving = false;
- if (reply.status == .err and (req.op == .write or req.op == .setattr or (req.op == .open and reply.errno == ctlfs.E.NOSPC) or (req.op == .release and req.remove))) ctlfs.events.noteError(p, req, reply);
+ // The one-failure rule is a write's: a refused open (its OTRUNC's
+ // truncation, a setattr, too), create or remove is its Rerror alone,
+ // no err, as is a write to pane/new, which is only ever read.
+ const ruled = req.op == .write and req.node != @intFromEnum(ctlfs.TopFile.new);
+ if (reply.status == .err and ruled) ctlfs.events.noteError(p, req, reply);
// The request was a whole step of its own, so it settles the way a
// step does: the cursor and scroll reconciled, the scripted panes
// told, and the panes it made announced to /log now rather than at
@@ -7123,6 +7142,10 @@ pub const Pardes = struct {
/// sleep exactly as long as nothing changes.
pub fn nextWake(p: *const Pardes) ?u64 {
const next = p.stepped_ns + animation.frame_ns;
+ // Held 9P writes go in when they pause: wake for it, never before
+ // the next frame (writes served before the shell's clock was first
+ // seen are stamped 0, which `advance` would count back from).
+ if (p.fs.batch.bytes.items.len > 0) return @max(next, p.fs.batch.last_ns + ctlfs.pane.batch_pause_ns);
if (p.chrome_animation.isActive() or p.presentation.animating()) return next;
var frames: ?u64 = null;
if (p.look_hover_wait) |waiting| {