From 42748f92b77367db415c8b4d0f2e537a9e1ddde7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 00:13:11 -0300 Subject: Make the column and workspace tags Texts with the pane tag's keys The headers had their own one-line editor with its own keys: Enter always executed, h/l and J/K moved between headers and panes, Ctrl-c/x/v cut and pasted, and TagLine refused a newline that 9P accepted. They are now Texts like a pane's tag, with no prefix and a default until edited, so normal and insert mode, undo and the look and execute keys are the body's. Moving between them is the window keys' job: Up from a pane with nothing above it reaches its column's tag and then the workspace's, Down comes back, and Left and Right walk the column tags. Co-Authored-By: Claude Opus 5.5 --- src/tag_line.zig | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 src/tag_line.zig (limited to 'src/tag_line.zig') diff --git a/src/tag_line.zig b/src/tag_line.zig deleted file mode 100644 index d3bdf59c..00000000 --- a/src/tag_line.zig +++ /dev/null @@ -1,42 +0,0 @@ -//! Bounded, single-line editable chrome. Offsets are UTF-8 byte offsets. -const std = @import("std"); -const modal = @import("modal.zig"); -pub const Line = struct { - text: [@import("memory.zig").limits.max_tag_tail]u8 = undefined, - len: usize = 0, - custom: bool = false, - saved_col: ?u16 = null, - - pub fn slice(self: *const Line, fallback: []const u8) []const u8 { - return if (self.custom) self.text[0..self.len] else fallback; - } - pub fn set(self: *Line, bytes: []const u8) bool { - if (bytes.len > self.text.len or std.mem.indexOfAny(u8, bytes, "\r\n\x00") != null or !std.unicode.utf8ValidateSlice(bytes)) return false; - @memcpy(self.text[0..bytes.len], bytes); - self.len = bytes.len; - self.custom = true; - return true; - } - pub fn replace(self: *Line, fallback: []const u8, lo: usize, hi: usize, bytes: []const u8) bool { - const current = self.slice(fallback); - if (lo > hi or hi > current.len) return false; - var next: [@import("memory.zig").limits.max_tag_tail]u8 = undefined; - const size = lo + bytes.len + current.len - hi; - if (size > next.len) return false; - @memcpy(next[0..lo], current[0..lo]); - @memcpy(next[lo..][0..bytes.len], bytes); - @memcpy(next[lo + bytes.len ..][0 .. current.len - hi], current[hi..]); - return self.set(next[0..size]); - } -}; - -test "tag replacement is atomic and keeps UTF-8 intact" { - var line: Line = .{}; - try std.testing.expect(line.replace("New Find", 4, 8, "Grep")); - try std.testing.expectEqualStrings("New Grep", line.slice("")); - try std.testing.expect(!line.replace("", 0, 0, "bad\nline")); - try std.testing.expectEqualStrings("New Grep", line.slice("")); - try std.testing.expect(line.set("é界")); - try std.testing.expect(line.replace("", 0, modal.nextGrapheme(line.slice(""), 0), "")); - try std.testing.expectEqualStrings("界", line.slice("")); -} -- cgit v1.3