summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 282ae473..8e827fba 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -3,6 +3,7 @@
//! mark and scroll, errors, event, look and exec. Terminals add pty/ (pty.zig).
const std = @import("std");
const pardes = @import("../pardes.zig");
+const tagline = @import("../tagline.zig");
const exec = @import("../exec.zig");
const look = @import("../look.zig");
const panes = @import("../panes.zig");
@@ -79,7 +80,7 @@ pub fn fileOf(pane: *Pane) ?*panes.File.State {
}
pub fn tagOf(p: *Pardes, pane: *Pane) []const u8 {
- return p.tagText(p.scratch.allocator(), pane) catch "";
+ return tagline.tagText(p, p.scratch.allocator(), pane) catch "";
}
pub fn dirOf(pane: *Pane) []const u8 {
@@ -422,7 +423,7 @@ fn writeTag(req: Req, pane: *Pane) Reply {
if (req.data.len == 0) return .{ .tag = req.tag, .written = 0 };
// The tag's own text grows by what is written, newlines and all: a tag
// is a text like any other (acme's tag file appends the same way).
- const had = Pardes.curTail(pane).len;
+ const had = tagline.curTail(pane).len;
const room = limits.max_tag_tail -| had;
if (room == 0) return Reply.fail(req.tag, E.NOSPC);
const take = wholeUtf8(req.data[0..@min(req.data.len, room)]);
@@ -746,7 +747,7 @@ test "tag reads the whole tag and writes append to the editable tail" {
const before = rd(p, node, 0, 4096).bytes.len;
const w = wr(p, node, " Mine");
try testing.expectEqual(@as(u32, 5), w.reply.written);
- try testing.expect(std.mem.endsWith(u8, Pardes.curTail(pane), " Mine"));
+ try testing.expect(std.mem.endsWith(u8, tagline.curTail(pane), " Mine"));
const after = rd(p, node, 0, 4096);
try testing.expectEqual(before + 5, after.bytes.len);
try testing.expect(std.mem.endsWith(u8, after.bytes, " Mine"));
@@ -754,7 +755,7 @@ test "tag reads the whole tag and writes append to the editable tail" {
// A tag is a text like the body: a newline written to it stays one, and
// the tag reads back taller by it.
try testing.expectEqual(@as(u32, 10), wr(p, node, "\nNext Line").reply.written);
- try testing.expect(std.mem.endsWith(u8, Pardes.curTail(pane), " Mine\nNext Line"));
+ try testing.expect(std.mem.endsWith(u8, tagline.curTail(pane), " Mine\nNext Line"));
try testing.expect(std.mem.endsWith(u8, rd(p, node, 0, 4096).bytes, " Mine\nNext Line"));
if (pane.tag.own) |own| p.gpa.free(own);
@@ -887,7 +888,7 @@ test "truncating the tag clears its editable tail" {
const pane = p.panes[0].?;
const tag = Node.of(pane.serial, .tag);
_ = wr(p, tag, " Mine");
- try testing.expect(Pardes.curTail(pane).len > 0);
+ try testing.expect(tagline.curTail(pane).len > 0);
const cleared = call(p, .{ .tag = 1, .op = .setattr, .node = tag, .truncate = true });
try testing.expectEqual(Status.ok, cleared.reply.status);
try testing.expectEqualStrings("", pane.tag.own.?);