summaryrefslogtreecommitdiff
path: root/core/Trail.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Trail.zig')
-rw-r--r--core/Trail.zig35
1 files changed, 20 insertions, 15 deletions
diff --git a/core/Trail.zig b/core/Trail.zig
index e42ab1e2..cd115018 100644
--- a/core/Trail.zig
+++ b/core/Trail.zig
@@ -701,7 +701,7 @@ fn tagGroundOf(p: *Pardes, arena: *std.heap.ArenaAllocator, id: usize) !pardes.C
return s.at(r.x + pardes.TAG_TEXT_INSET, p.tagTop(p.panes[id].?, r)).style.bg;
}
-test "a file's pane is reading, its tag in the reading tint with Keep after its path; typed into, it is held, and Jumps new-pane reads none" {
+test "a file's pane is reading, Keep after its path and its grip in the mode's mark, its tag on its focus's ground (DESIGN.md G1'); typed into, it is held, and Jumps new-pane reads none" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
@@ -710,12 +710,14 @@ test "a file's pane is reading, its tag in the reading tint with Keep after its
const pane = try p.setTestFile("alpha\nbeta\n");
try std.testing.expect(reading(p, pane));
try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, pane), "/test.txt Keep "));
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().tag_reading_bg }, try tagGroundOf(p, &arena, 0));
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).ground }, try tagGroundOf(p, &arena, 0));
+ try std.testing.expect(p.surface.region(.grip, 0).?.reading);
// Under Jumps new-pane nothing reads: the tag as it always was.
p.settings.jumps = .@"new-pane";
try std.testing.expect(!reading(p, pane));
try std.testing.expectEqualStrings("/test.txt Del ", try tagOf(p, pane));
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().tag_active_bg }, try tagGroundOf(p, &arena, 0));
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).ground }, try tagGroundOf(p, &arena, 0));
+ try std.testing.expect(!p.surface.region(.grip, 0).?.reading);
p.settings.jumps = .walk;
// Typed into: held from now on, though Undo takes the text back.
typeKeys(p, "ix");
@@ -724,7 +726,8 @@ test "a file's pane is reading, its tag in the reading tint with Keep after its
try std.testing.expectEqualStrings("alpha\nbeta\n", pane.file.?.content);
try std.testing.expect(!reading(p, pane));
try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, pane), "Keep") == null);
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().tag_active_bg }, try tagGroundOf(p, &arena, 0));
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).ground }, try tagGroundOf(p, &arena, 0));
+ try std.testing.expect(!p.surface.region(.grip, 0).?.reading);
}
test "Keep holds a reading pane; a scratch and a listing are never reading" {
@@ -927,9 +930,9 @@ test "the session of pick-ui §6.7: four jumps across three files, back by a cli
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
const s = try p.render(arena.allocator());
- // In the dim ink of the reading tag's ground (UX D4: 3:1 at least).
+ // In the dim ink of the focused tag's ground (UX D4: 3:1 at least).
const dim = try tagCell(p, r, "place.zig:40");
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().roles.on(.reading_focused).dim }, s.at(dim[0], dim[1]).style.fg);
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).dim }, s.at(dim[0], dim[1]).style.fg);
// A click on a forward step goes forward to it.
try clickTag(p, r, "place.zig:9", .left);
r = p.view().active;
@@ -982,11 +985,13 @@ test "the walk drawn with a picker's list and the notice row (walk UI G 2e, SPEC
try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, p.panes[rd].?), try std.fmt.bufPrint(&want, "‹@p{d} › rank.zig:12 › Refs 1/2 › {s}/place.zig Keep ", .{ owner, f.dir })));
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
- // The reader's tag in the reading tint, the held one's not; the notice
- // row says what Ctrl-o goes back to (UX L'1), and with nothing said,
- // where the reader's caret is.
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().tag_reading_bg }, try tagGroundOf(p, &arena, rd));
- try std.testing.expect(!std.meta.eql(pardes.Color{ .rgb = p.chromeTheme().tag_reading_bg }, try tagGroundOf(p, &arena, f.held)));
+ // The reader's tag on the focused ground, the held one's on the plain
+ // (G1': the mode is on the reader's grip); the notice row says what
+ // Ctrl-o goes back to (UX L'1), and with nothing said, where the
+ // reader's caret is.
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).ground }, try tagGroundOf(p, &arena, rd));
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.plain).ground }, try tagGroundOf(p, &arena, f.held));
+ try std.testing.expect(p.surface.region(.grip, rd).?.reading and !p.surface.region(.grip, f.held).?.reading);
for ([_][]const u8{ "C-o back to Refs 1/2", try std.fmt.bufPrint(&want, "{s}/place.zig:8", .{f.dir}) }) |said| {
const s = try p.render(arena.allocator());
const foot = s.region(.notice_row, pardes.Region.none).?.rect;
@@ -1020,8 +1025,8 @@ test "a trail keeps its newest three back steps whole, older ones fold into one
defer arena.deinit();
const s = try p.render(arena.allocator());
const fold = try tagCell(p, r, "+2");
- // In the dim ink of the reading tag's ground (UX D4).
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().roles.on(.reading_focused).dim }, s.at(fold[0], fold[1]).style.fg);
+ // In the dim ink of the focused tag's ground (UX D4).
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).dim }, s.at(fold[0], fold[1]).style.fg);
try clickTag(p, r, "+2", .right);
try std.testing.expectEqualStrings("rank.zig:20", f.at(&at));
// Back at the first: five forward steps, the two nearest whole.
@@ -1111,7 +1116,7 @@ test "a step whose tag would take a row its column cannot give folds to its newe
defer arena.deinit();
const s = try p.render(arena.allocator());
const base = try tagCell(p, r, "long.zig");
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().tag_active_name_fg }, s.at(base[0], base[1]).style.fg);
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().name[1] }, s.at(base[0], base[1]).style.fg);
// A click on the path drafts a name: the whole path, its caret where
// the click was (on the first byte shown after the `…`).
const after = v.rects[r];
@@ -1206,7 +1211,7 @@ test "two steps whose files have the same name are told apart by the shortest pa
const word = try tagCell(p, r, "Find x 1/2");
try std.testing.expect(s.at(word[0], word[1]).style.ul == .single);
// In the key ink (UX D8, D4).
- try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().roles.key }, s.at(word[0], word[1]).style.fg);
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().on(.focus).key }, s.at(word[0], word[1]).style.fg);
const other = try tagCell(p, r, "place.zig");
try std.testing.expect(s.at(other[0], other[1]).style.ul != .single);
}