summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/file_watch.zig5
-rw-r--r--src/gui/gui.zig9
-rw-r--r--src/tui/tui.zig18
3 files changed, 8 insertions, 24 deletions
diff --git a/src/file_watch.zig b/src/file_watch.zig
index 33c14248..e8155bb9 100644
--- a/src/file_watch.zig
+++ b/src/file_watch.zig
@@ -419,6 +419,11 @@ pub fn watchPane(
}
}
+/// Every pane's mark dropped (a Restore's old core, a test's end).
+pub fn unwatchAll(fd: c_int, watches: *Table) void {
+ for (0..pardes.MAX_PANES) |id| watchPane(fd, watches, @intCast(id), null, 0, .{ .text = 0 });
+}
+
/// Mark the post chain files' directories, one slot each, dropping the
/// marks of files no longer in it.
pub fn watchShaders(fd: c_int, watches: *Table, paths: []const []const u8) void {
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 711f0657..95df9fac 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -2544,14 +2544,7 @@ fn localSession(
shell.gview = 0;
shell.windowed = 1;
shell.stopPtys();
- for (0..pardes.MAX_PANES) |wid| file_watch.watchPane(
- inotify_fd,
- &watches,
- @intCast(wid),
- null,
- 0,
- .{ .text = 0 },
- );
+ file_watch.unwatchAll(inotify_fd, &watches);
_ = file_watch.applyThemeEffect(core, gpa, inotify_fd, &watches, 0, false, false);
clearNativeImages(g);
g.presented_images.clearRetainingCapacity();
diff --git a/src/tui/tui.zig b/src/tui/tui.zig
index d0e923a1..3a5c277e 100644
--- a/src/tui/tui.zig
+++ b/src/tui/tui.zig
@@ -1061,14 +1061,7 @@ test "host watch closes initial race and reloads rename-over PDF while idle" {
if (fd < 0) return error.WatchInitFailed;
defer _ = libc.close(fd);
var watches: file_watch.Table = @splat(null);
- defer for (0..pardes.MAX_PANES) |id| file_watch.watchPane(
- fd,
- &watches,
- @intCast(id),
- null,
- 0,
- .{ .text = 0 },
- );
+ defer file_watch.unwatchAll(fd, &watches);
const core = try pardes.Pardes.init(gpa, .{ .file = path, .cols = 80, .rows = 28 });
defer core.deinit();
@@ -1775,14 +1768,7 @@ fn localSession(
sh.pipe_tasks.cancelAll(io);
for (&sh.gens) |*generation| generation.* +%= 1;
for (0..pardes.MAX_PANES) |pane| Shell.closePty(&sh, @intCast(pane));
- for (0..pardes.MAX_PANES) |wid| file_watch.watchPane(
- sh.inotify_fd,
- &sh.watches,
- @intCast(wid),
- null,
- 0,
- .{ .text = 0 },
- );
+ file_watch.unwatchAll(sh.inotify_fd, &sh.watches);
_ = file_watch.applyThemeEffect(core, gpa, sh.inotify_fd, &sh.watches, 0, false, false);
// ponytail: a restored session is one view, the live one's
// terminal: the others are let go, as a detach of each.