From 1374e668fe568ad4f7f70c06156c1ecdbb8840b9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 10:16:05 -0300 Subject: body_layer: a file pane's caret left of a view scrolled sideways is off the view, not drawn in the line-number gutter: renderBody showed the caret wherever gutter + its display offset was >= 0, and an offset of -4 (one wheel notch right, the caret at column 0) put it 3 columns into the 7-column gutter; a busy session drew the first of two notches as a frame of its own, so the terminal's cursor stayed there (process-test hscroll's 'wheeled': cursor 3,9 against 7,9, 6 of 30 runs pinned to one CPU, once in 3 whole runs at a load of 32-40); File.zig's test 'a caret left of a view scrolled sideways...' failed before; after, pinned to one CPU: 0 of 30; the five together: tui core-test 859/1014, shell-test 1055/1058, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay, process-test 0 of 144 (cmdexit once, again alone), daemon.py in every mode, both soaks diverged 0 unequal 0, gui unit-test 1651/1655 (BaselineHarnessMismatch), the frame and perf gate against tree2 PASS Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/File.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/File.zig') diff --git a/core/File.zig b/core/File.zig index 51773c89..ceb6d03b 100644 --- a/core/File.zig +++ b/core/File.zig @@ -2356,6 +2356,20 @@ test "a caret deep in a long line scrolls the view sideways to it, measured from try std.testing.expectEqual(@as(i32, 0), pane.hscroll); } +test "a caret left of a view scrolled sideways is not drawn in the gutter" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + p.settings.wrap = false; + const pane = try p.setTestFile("short1 END_A_MARKER_WAY_OUT_RIGHT_padpadpadpadpadpadpadpadpadpadpad_TAIL\n"); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + try std.testing.expect((try p.render(arena.allocator())).cursor != null); + // One wheel notch (4 columns) of the 7 the gutter is: the caret, at + // column 0, was drawn 3 columns into the gutter. + pane.hscroll = 4; + try std.testing.expect((try p.render(arena.allocator())).cursor == null); +} + test "undo and redo walk back and forth through every step of random edits, joined entries and all" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); -- cgit v1.3