diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 9e6a2d7f..153a07c9 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -156,21 +156,6 @@ pub const COLBAR_H: u16 = 1; pub const BOX_H: u16 = 1; pub const TAG_TEXT_INSET: u16 = config.GUTTER; -pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { - const spare = cell_h -| tagline_h; - const rows: u32 = @max(1, @as(u32, @intFromFloat(@floor(canvas_h / @as(f32, @floatFromInt(cell_h)))))); - // Every band centers in its cell, so text and anchors sit at the same - // height in the workspace, column and pane tags alike. Only the last row - // faces the window edge (Tagbottom). - if (@as(u32, row) + 1 >= rows) return spare; - return spare / 2; -} - -pub fn topbarPaneBorderPixels(cell_h: u32, tagline_h: u32) u32 { - const spare = cell_h -| tagline_h; - return @min(@as(u32, config.gui_topbar_pane_border_px), spare * 2); -} - pub fn taglineOriginCol(p: *const Pardes, col: u16, row: u16) f32 { if (row < p.topBarHeight()) return 0; if (row < p.topBarHeight() + layout.columnBarHeight(p)) { @@ -1670,27 +1655,6 @@ comptime { } } -const WordBounds = struct { lo: usize, hi: usize }; - -/// The space-delimited word covering `col` in `str` (a header's click and -/// hover), null on a space or past the end. -pub fn wordBoundsAtCol(str: []const u8, col: usize) ?WordBounds { - if (col >= str.len or str[col] == ' ') return null; - var lo: usize = col; - while (lo > 0 and str[lo - 1] != ' ') lo -= 1; - var hi: usize = col; - while (hi < str.len and str[hi] != ' ') hi += 1; - return .{ .lo = lo, .hi = hi }; -} - -/// `a` IS `b` or lives under it — how Grep drops a pane's directory when -/// another pane's directory already covers it -pub fn pathUnder(a: []const u8, b: []const u8) bool { - const root = std.mem.trimEnd(u8, b, "/"); - if (!std.mem.startsWith(u8, a, root)) return false; - return a.len == root.len or a[root.len] == '/'; -} - test "Tab N draws every pane's tab N cells wide and clicks count past it; bare Tab says the width; the ctl read and a Dump keep it" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 60, .rows = 12 }); @@ -3657,9 +3621,6 @@ pub const Pardes = struct { p.fs.late_failure_len = @intCast(kept.len); } - /// The rows n/N's walk over look-able text reads before it stops (look.zig). - pub const max_look_rows = 8192; - /// The frontend drew a frame: a pointer resting on it follows what is /// under it now, a drag's moving end and a look-hover's word. pub fn presented(p: *Pardes) void { @@ -4427,12 +4388,3 @@ test "every allocation failure during boot is a clean OutOfMemory" { try std.testing.checkAllAllocationFailures(std.testing.allocator, bootAndTearDown, .{}); } -test "tagline bands center in their cells and Tagbottom faces the window edge" { - const cell_h: u32 = 20; - const tagline_h: u32 = 16; - const canvas_h: f32 = 200; - // Workspace, column and pane rows alike: text lines up across bands. - for ([_]u16{ 0, 1, 2, 5, 8 }) |row| - try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(row, canvas_h, cell_h, tagline_h)); - try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h)); -} |
