WIP: use viewport to allow sizes of scroll to extend further than renderable screen
This commit is contained in:
@@ -2,8 +2,8 @@ const std = @import("std");
|
||||
const terminal = @import("terminal.zig");
|
||||
|
||||
const Cell = @import("cell.zig");
|
||||
const Size = @import("size.zig");
|
||||
const Position = Size.Position;
|
||||
const Position = @import("size.zig").Position;
|
||||
const Size = @import("size.zig").Size;
|
||||
|
||||
/// Double-buffered intermediate rendering pipeline
|
||||
pub const Buffered = struct {
|
||||
@@ -62,17 +62,17 @@ pub const Buffered = struct {
|
||||
|
||||
/// Render provided cells at size (anchor and dimension) into the *virtual screen*.
|
||||
pub fn render(this: *@This(), comptime T: type, container: *T) !void {
|
||||
const size: Size = container.size;
|
||||
const viewport: Size = container.viewport;
|
||||
const cells: []const Cell = try container.contents();
|
||||
|
||||
if (cells.len == 0) return;
|
||||
|
||||
var idx: usize = 0;
|
||||
var vs = this.virtual_screen;
|
||||
const anchor = (size.anchor.row * this.size.cols) + size.anchor.col;
|
||||
const anchor = (viewport.anchor.row * this.size.cols) + viewport.anchor.col;
|
||||
|
||||
blk: for (0..size.rows) |row| {
|
||||
for (0..size.cols) |col| {
|
||||
blk: for (0..viewport.rows) |row| {
|
||||
for (0..viewport.cols) |col| {
|
||||
const cell = cells[idx];
|
||||
idx += 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user