diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
| commit | 0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (patch) | |
| tree | f2e288668decded9276ebc45907f16d651b06f9e /dev/file_watch.zig | |
| parent | 2ab05b536bc3b063666b5aaab497157adc2a9120 (diff) | |
| parent | bf351b62e8843a3d173cedeefa2dd0b8ef4b4392 (diff) | |
| download | pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.tar.gz pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.zip | |
integration: a pane's and a view's slot as types, with the regular-expression fixes and the fixes the real loops asked for: pardes-ids (Pane.Id and View.Id through the entries, the events, the effects, the Host table and the device messages) and pardes-merge21, merged without a textual conflict; one call site written since on the old type follows (core/draw.zig: the twin test's file_changed event, .pane = .at(0)); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/file_watch.zig')
| -rw-r--r-- | dev/file_watch.zig | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/dev/file_watch.zig b/dev/file_watch.zig index 9d868e07..84f37c81 100644 --- a/dev/file_watch.zig +++ b/dev/file_watch.zig @@ -459,7 +459,7 @@ pub fn reloadPane( if (pane.file) |file| { const bytes = filesystem.read(core, file.path) catch |err| { // Gone from under the pane: said once, the text kept. - if (err == error.FileNotFound and watched.existed == std.hash.Wyhash.hash(0, file.path)) pardes.panes.File.deleted(core, @intCast(id)); + if (err == error.FileNotFound and watched.existed == std.hash.Wyhash.hash(0, file.path)) pardes.panes.File.deleted(core, .at(id)); return false; }; if (watches[id]) |*live| live.existed = std.hash.Wyhash.hash(0, file.path); @@ -477,7 +477,7 @@ pub fn reloadPane( }; return false; } - if (!core.reloadWatchedFile(@intCast(id), bytes)) return false; + if (!core.reloadWatchedFile(.at(id), bytes)) return false; const current = core.panes[id] orelse return false; if (current.serial != watched.serial) return false; const current_file = current.file orelse return false; @@ -488,7 +488,7 @@ pub fn reloadPane( } if (announce) { var msg_buf: [256]u8 = undefined; - core.setMessage(id, message.stamp(&msg_buf, "reloaded", current_file.path)); + core.setMessage(.at(id), message.stamp(&msg_buf, "reloaded", current_file.path)); } return false; } @@ -510,7 +510,7 @@ pub fn reloadPane( .text => {}, } // Its kind reads the file again (Kind.fileChanged): on the tape, no bytes. - if (!core.reloadWatchedFile(@intCast(id), &.{})) return false; + if (!core.reloadWatchedFile(.at(id), &.{})) return false; const current = core.panes[id] orelse return false; if (current.serial != watched.serial) return false; const current_path = kindPath(current) orelse return false; @@ -522,7 +522,7 @@ pub fn reloadPane( } if (announce) { var msg_buf: [256]u8 = undefined; - core.setMessage(id, message.stamp(&msg_buf, "reloaded", current_path)); + core.setMessage(.at(id), message.stamp(&msg_buf, "reloaded", current_path)); } return false; } @@ -611,12 +611,12 @@ pub fn applyThemeEffect( const pane = request.pane; const bytes = filesystem.readFile(&pardes.tape.none, gpa, request.path) catch |err| { colors.failThemeFile(core, generation, err); - core.noteLateFailure(pane); + core.noteLateFailure(.at(pane)); return false; }; defer gpa.free(bytes); if (!colors.loadThemeFile(core, generation, bytes)) { - core.noteLateFailure(pane); + core.noteLateFailure(.at(pane)); return false; } const hash = std.hash.Wyhash.hash(0, bytes); @@ -659,7 +659,7 @@ pub fn reloadTheme( live.generation = .{ .text = hash }; if (announce) { var msg_buf: [256]u8 = undefined; - core.setMessage(request.pane, message.stamp(&msg_buf, "reloaded theme", request.path)); + core.setMessage(.at(request.pane), message.stamp(&msg_buf, "reloaded theme", request.path)); } return false; } @@ -706,7 +706,7 @@ test "a restored file is watched again: one clean takes what its file became sin defer watchPane(fd, &watches, id, null, pane.serial, .{ .text = 0 }); var armed = false; while (core.nextEffect()) |effect| switch (effect) { - .watch => |watch| if (watch.pane == id and watch.on) { + .watch => |watch| if (watch.pane.index() == id and watch.on) { _ = applyEffect(core, io, fd, &watches, id, watch.on, watch.mode); armed = true; }, @@ -774,7 +774,7 @@ test "ordinary file watches still reconcile changes between open and watch" { defer watchPane(fd, &watches, id, null, pane.serial, .{ .text = 0 }); var armed = false; while (core.nextEffect()) |effect| switch (effect) { - .watch => |watch| if (watch.pane == id and watch.on) { + .watch => |watch| if (watch.pane.index() == id and watch.on) { try std.testing.expectEqual(.reconcile, watch.mode); try std.testing.expect(!applyEffect(core, io, fd, &watches, id, watch.on, watch.mode)); armed = true; @@ -949,7 +949,7 @@ test "a watched file deleted wakes the watch at once, and its pane says so" { var watches: Table = @splat(null); defer watchPane(fd, &watches, id, null, pane.serial, .{ .text = 0 }); while (core.nextEffect()) |effect| switch (effect) { - .watch => |watch| if (watch.pane == id and watch.on) { + .watch => |watch| if (watch.pane.index() == id and watch.on) { _ = applyEffect(core, io, fd, &watches, id, watch.on, watch.mode); }, else => {}, |
