From e0b3f11f008e54174d5169147b8cf5dac56e915a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 19:41:44 -0300 Subject: A tag no longer marks an unsaved file with *: the grip shows it The grip button now shows a pane's unsaved text in every state, as acme's modbutton does, and acme's tag has no asterisk. The computed prefix is the name alone, so tag reads, event offsets that count the path and the tag's text lose the " *". dirty, index's flag and the refuse-once guards are unchanged; a dump from before still restores its tags past the old mark. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index 7cdd8461..a232c9c6 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1251,37 +1251,19 @@ test "pane defaults keep creation of scratch panes in column tags" { try std.testing.expectEqualStrings(tagline.file_pane_tail, tagline.curTail(file)); } -test "an unsaved file marker sits between its path and builtins until Save" { +test "an unsaved file's tag is its name alone: the grip, not a mark, says it is unsaved" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = try p.setTestFile("before\n"); - const clean = try tagline.tagText(p, p.scratch.allocator(), pane); - try std.testing.expect(std.mem.indexOf(u8, clean, "/test.txt *") == null); - panes.File.setContent(p, &pane.file.?, try gpa.dupe(u8, "after\n")); const dirty = try tagline.tagText(p, p.scratch.allocator(), pane); - const marker_at = std.mem.indexOf(u8, dirty, "/test.txt *") orelse return error.MissingDirtyMarker; - const save_at = std.mem.indexOf(u8, dirty, "Save") orelse return error.MissingSaveBuiltin; - try std.testing.expect(marker_at < save_at); - - try std.testing.expect(p.executeBuiltinLine(0, "Save")); - while (p.nextEffect()) |effect| p.perform(effect); - const saved = try tagline.tagText(p, p.scratch.allocator(), pane); - try std.testing.expect(std.mem.indexOf(u8, saved, "/test.txt *") == null); - - panes.File.changed(p, 0, "external\n"); - const reloaded = try tagline.tagText(p, p.scratch.allocator(), pane); - try std.testing.expect(std.mem.indexOf(u8, reloaded, "/test.txt *") == null); - - // A generated output is file-shaped and Save can write it to a path, but - // there is no file of its own for it to be dirty against. - pane.file.?.output = .{ .from = .search }; - panes.File.setContent(p, &pane.file.?, try gpa.dupe(u8, "result\n")); - const output = try tagline.tagText(p, p.scratch.allocator(), pane); - try std.testing.expect(std.mem.indexOf(u8, output, "/test.txt *") == null); + try std.testing.expectEqualStrings(clean, dirty); + try std.testing.expect(std.mem.indexOf(u8, dirty, " *") == null); + // The dirty file and index's flag still say it. + try std.testing.expect(ctlfs.pane.dirtyOf(pane)); } test "unknown Exec from a document runs as a command pane in its directory, typed into no terminal" { -- cgit v1.3