diff options
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 48a30b8d..3bb304f0 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -4422,7 +4422,7 @@ test "a wheel over codex in a terminal reaches its pty as the mouse reports it a wheelAt(&g, &in, .{ .y = 1, .integer_y = 1, .mods = .{ .shift = true } }, mc); try std.testing.expectEqualStrings("", try Sent.take(core, &sent)); try std.testing.expectEqual(@as(i32, -1), g.scroll_notch); - stepGlide(&g, core, gpa); + stepGlide(&g, core); try std.testing.expectEqualStrings("", try Sent.take(core, &sent)); resetScroll(&g); // Its sign-in screen: mouse off, alternate scroll on, so arrow keys. @@ -4443,8 +4443,7 @@ const Glide = pardes.glide.Glide; /// Feeds a wheel's notches to the core, and keeps what moved the view for /// the frame's glide (Glide.frame). -fn stepGlide(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { - _ = gpa; +fn stepGlide(g: *Gui, core: *pardes.Pardes) void { const notch = g.scroll_notch; g.scroll_notch = 0; var wheeled: ?usize = null; @@ -4523,7 +4522,7 @@ test "a notch scrolls the core at once and the picture glides after it, a wrappe // One notch down: the core is a line on at once. g.scroll_notch = 1; const scrolled = core.panes[core.view().active].?.scroll(); - stepGlide(&g, core, gpa); + stepGlide(&g, core); try std.testing.expectEqual(scrolled + 1, core.panes[core.view().active].?.scroll()); _ = arena.reset(.retain_capacity); s = try core.render(arena.allocator()); @@ -4540,7 +4539,7 @@ test "a notch scrolls the core at once and the picture glides after it, a wrappe while (g.glide.moving()) : (frames += 1) { now += 7 * ms; core.advance(now); - stepGlide(&g, core, gpa); + stepGlide(&g, core); g.now_ns = now; glideFrame(&g, gpa, s); try std.testing.expect(g.glide.follow.offset <= 1e-4); @@ -4576,13 +4575,13 @@ test "a wheel's caret rides with its line, the text's own glide, never a spring g.scroll_pane = core.view().active; g.scroll_col = r.x + 10; g.scroll_row = r.y + r.h - 2; - stepGlide(&g, core, gpa); + stepGlide(&g, core); // The window has drawn the view once (Glide.frame finds a view that moved). g.now_ns = now; glideFrame(&g, gpa, s); const before: f32 = @floatFromInt(s.cursor.?.y); g.scroll_notch = 1; - stepGlide(&g, core, gpa); + stepGlide(&g, core); var frames: usize = 0; while (true) : (frames += 1) { now += 7 * std.time.ns_per_ms; @@ -4600,7 +4599,7 @@ test "a wheel's caret rides with its line, the text's own glide, never a spring // Always exactly with its line, the cell less the text's offset. try std.testing.expectApproxEqAbs(@as(f32, @floatFromInt(s.cursor.?.y)) - g.glide.follow.offset, caretRow(&g, s, now).?, 1e-3); if (!g.glide.moving()) break; - stepGlide(&g, core, gpa); + stepGlide(&g, core); if (frames > 200) return error.NeverSettled; } try std.testing.expectEqual(@as(f32, @floatFromInt(s.cursor.?.y)), caretRow(&g, s, now).?); @@ -4625,7 +4624,7 @@ const GlideRun = struct { while (next < script.len and script[next].frame == frame) : (next += 1) core.update(.{ .key = script[next].key }); now += std.time.ns_per_s / 60; core.advance(now); - stepGlide(g, core, gpa); + stepGlide(g, core); _ = arena.reset(.retain_capacity); const s = try core.render(arena.allocator()); g.now_ns = now; @@ -4788,7 +4787,7 @@ fn resetScroll(g: *Gui) void { } fn stepScroll(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { - stepGlide(g, core, gpa); + stepGlide(g, core); const id = g.scroll_pane orelse return; const pane = core.panes[id] orelse { resetScroll(g); |
