diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Terminal.zig | 2 | ||||
| -rw-r--r-- | src/draw.zig | 8 | ||||
| -rw-r--r-- | src/look.zig | 1 | ||||
| -rw-r--r-- | src/tagline.zig | 8 |
4 files changed, 13 insertions, 6 deletions
diff --git a/src/Terminal.zig b/src/Terminal.zig index 76be29d0..504ab887 100644 --- a/src/Terminal.zig +++ b/src/Terminal.zig @@ -2505,6 +2505,8 @@ test "a prompt row hidden end to end paints nothing at all" { defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; + pane.tag_expanded = false; // a 12x8 screen: the body, not the tag + p.sync(); pane.tty_filter = false; pane.body.mode = .normal; p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;A\x1b\\\x1b[32maaaaaaaaa\x1b]133;B\x1b\\\x1b[41;36m\u{754C}\x1b[0m\r\n" } }); diff --git a/src/draw.zig b/src/draw.zig index 963d61c1..fb770b60 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -987,9 +987,11 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r // The grid's row: the gap cell and the text, as far as the pane. joinCells(s, region.rect.x, region.rect.y + @as(u16, @intCast(line)), storage[line * pitch ..][0..pitch], config.GUTTER, region.rect.w, tag_fg); } - if (temporary.cursor) |cursor| if (cursor.x - TAG_TEXT_INSET < r.w - TAG_TEXT_INSET) { - s.cursor = .{ .x = r.x + cursor.x, .y = region.rect.y + cursor.y, .bar = cursor.bar }; - }; + // Past a full row's end the layer's caret is at the tag's edge, as + // acme's tick is; the grid has no cell there, so it takes the last one. + if (temporary.cursor) |cursor| { + s.cursor = .{ .x = r.x + @min(cursor.x, r.w - 1), .y = region.rect.y + cursor.y, .bar = cursor.bar }; + } } /// A notice chip, painted once as a tag layer at the tagline's pitch, and the diff --git a/src/look.zig b/src/look.zig index d90d27b8..17746cd1 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1378,6 +1378,7 @@ test "Look hover waits without mutating the pane and input cancels it" { while (p.nextEffect()) |_| {} const other_id = p.freeSlot() orelse return error.NoSparePaneForHoverTest; _ = try p.newShell(other_id, ""); + p.panes[other_id].?.tag_expanded = false; // the blank spot right of the file is its body, not its tag try std.testing.expect(layout.splitColumn(p, 0, other_id, false)); p.sync(); while (p.nextEffect()) |_| {} diff --git a/src/tagline.zig b/src/tagline.zig index 68fa2645..d024be4e 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -286,10 +286,12 @@ pub fn wrapTag(arena: std.mem.Allocator, whole: []const u8, width: usize) !Shown return .{ .text = out.items, .soft = soft.items }; } -/// The tag's width for wrapping: its columns, one kept for the caret past -/// a full row's end. +/// The tag's width for wrapping: all its columns. A row the text fills +/// exactly stays one row, as acme's frame wraps a box only when it is wider +/// than what is left (libframe frutil.c _frcklinewrap), and the caret past +/// its end sits at the edge (frptofchar.c clamps it to r.max.x). pub fn tagWidth(p: *const Pardes, id: usize) usize { - return @max(1, @as(usize, p.tagCapacity(p.rects[id].w -| TAG_TEXT_INSET)) -| 1); + return @max(1, @as(usize, p.tagCapacity(p.rects[id].w -| TAG_TEXT_INSET))); } pub fn shownTag(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !Shown { |
