diff options
Diffstat (limited to 'core/File.zig')
| -rw-r--r-- | core/File.zig | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/File.zig b/core/File.zig index 75d8049b..ceb6d03b 100644 --- a/core/File.zig +++ b/core/File.zig @@ -1579,7 +1579,7 @@ pub fn refreshHighlights(p: *Pardes) void { // itself on the frame, a third of the work; the stretch around it // comes painted ahead (paintAhead) where there are workers. const far = f.highlights.len == 0 or need_end <= f.highlight_start or need_start >= f.highlight_start + f.highlights.len; - const slack: usize = if (far and p.host.vtable.search != null) 0 else if (f.highlights.len == 0) 0 else pane.rows; + const slack: usize = if (far and p.tape.has(p, .search)) 0 else if (f.highlights.len == 0) 0 else pane.rows; const whole = pane.colorAlgo() == .locations or f.tree_context; // Painted ahead on a worker (Stream.paintAhead): taken, no parse. if (!whole and pane.colorAlgo() == .source) if (Stream.takeAhead(p, pane.serial, f.revision, need_start, need_end)) |got| { @@ -2312,7 +2312,6 @@ test "a pager's text is a diff when it holds a diff header or a unified hunk" { } test "a long line is painted only around the caret" { - if (!syntax.enabled) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); const line = try std.testing.allocator.alloc(u8, 600 << 10); @@ -2357,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 }); |
