diff options
Diffstat (limited to 'core/Prompt.zig')
| -rw-r--r-- | core/Prompt.zig | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/core/Prompt.zig b/core/Prompt.zig index b76b2d9a..49a9645d 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -874,7 +874,7 @@ pub fn paintGutter(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, body_h: const tab = p.settings.tab; const x = gutterX(pane, r); const y = p.bodyTop(pane, r); - const ink = p.chromeTheme().roles.key; + const ink = p.chrome().page.key; const nlines = File.nlines(p.gpa, f); // `▸` on the current place's line alone: the lines with places are the // rail's ticks (Places.addTicks), never glyphs of their own (UX D14). @@ -953,8 +953,8 @@ pub fn ghosts(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: if (rows <= first) return; const w: usize = s.cols; const old = try arena.dupe(Cell, s.cells[(y0 + first) * w .. (y0 + rows) * w]); - const grounds = colors.Grounds.of(p.theme()); - const ink = p.theme().fg orelse p.theme().tag_fg; + const chrome = p.chrome(); + const ink = chrome.page.text; const x0 = r.x + config.GUTTER + File.gutterWidth(pane); const width = r.w -| (x0 - r.x); const ranges = live_run.ranges[0..live_run.nranges]; @@ -969,18 +969,18 @@ pub fn ghosts(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: // `!`: its output before the selection's first line. var j = k; if (how == .insert and opens) while (j < ranges.len and lineAt(index, @min(ranges[j].anchor, ranges[j].head)) == line) : (j += 1) { - out = ghostRows(s, live_run, j, out, rows, y0, x0, width, grounds.add.row, ink); + out = ghostRows(s, live_run, j, out, rows, y0, x0, width, chrome.add.row, ink); }; if (out >= rows) break; @memcpy(s.cells[(y0 + out) * w ..][0..w], old[(vr - first) * w ..][0..w]); j = k; while (j < ranges.len and lineAt(index, @min(ranges[j].anchor, ranges[j].head)) <= line) : (j += 1) { - if (how == .replace and outcome(live_run, j) == 0) s.tint(x0, @intCast(y0 + out), width, grounds.del.row, null); + if (how == .replace and outcome(live_run, j) == 0) s.tint(x0, @intCast(y0 + out), width, chrome.del.row, null); } out += 1; // `|` and `A-!`: after the selection's last line. if (how != .insert and closes) while (k < ranges.len and lineAt(index, @max(ranges[k].anchor, ranges[k].head) -| 1) == line) : (k += 1) { - out = ghostRows(s, live_run, k, out, rows, y0, x0, width, grounds.add.row, ink); + out = ghostRows(s, live_run, k, out, rows, y0, x0, width, chrome.add.row, ink); }; } // What was pushed past the view leaves blank rows behind it, none. @@ -1027,7 +1027,7 @@ fn fence(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, body_h: u16) void if (snap.len == 0) return; const x = gutterX(pane, r); const y = p.bodyTop(pane, r); - const ink = p.chromeTheme().box; + const ink = p.chrome().page.key; const nlines = File.nlines(p.gpa, f); const op = p.view().tag_state.prompt.op; var kept: [Text.max_selections]modal.Selection = undefined; @@ -1500,12 +1500,12 @@ test "/ searches the body as it is typed: the current place selected, `▸` in t { const s = try p.render(frame.allocator()); const r = p.view().rects[0]; - const roles = &p.chromeTheme().roles; + const c = p.chrome(); const x = r.x + config.GUTTER + File.gutterWidth(pane); const y = p.bodyTop(pane, r); - try std.testing.expectEqual(pardes.Color{ .rgb = roles.key }, s.at(x - 1 - File.laneCells(pane) - pane.layers.heat, y + 2).style.fg); + try std.testing.expectEqual(pardes.Color{ .rgb = c.page.key }, s.at(x - 1 - File.laneCells(pane) - pane.layers.heat, y + 2).style.fg); // Line 1's place (`dirty` at its start) on the hit ground. - try std.testing.expectEqual(pardes.Color{ .rgb = roles.hit }, s.at(x, y).style.bg); + try std.testing.expectEqual(pardes.Color{ .rgb = c.hit }, s.at(x, y).style.bg); } p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(TagState.Kind.rest, p.view().tag_state.kind); @@ -1651,8 +1651,10 @@ test "a pipe prompt runs a known filter live, a run a selection: the outputs gho const x = r.x + config.GUTTER + File.gutterWidth(pane); const y = p.bodyTop(pane, r); for ([_][]const u8{ "b", "B", "a", "A", "c" }, 0..) |want, row| try std.testing.expectEqualStrings(want, s.at(x, y + @as(u16, @intCast(row))).grapheme()); - try std.testing.expectEqual(pardes.Color{ .rgb = colors.Grounds.of(p.theme()).del.row }, s.at(x, y).style.bg); - try std.testing.expectEqual(pardes.Color{ .rgb = colors.Grounds.of(p.theme()).add.row }, s.at(x, y + 1).style.bg); + // On the chrome's diff rows (R10), the ghost in the page's text. + try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().del.row }, s.at(x, y).style.bg); + try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().add.row }, s.at(x, y + 1).style.bg); + try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().page.text }, s.at(x, y + 1).style.fg); try std.testing.expectEqualStrings("b\na\nc\n", pane.file.?.content); // Enter: what the live run made, applied. p.update(.{ .key = .{ .cp = Key.enter } }); |
