Replace vaxis with zterm #1

Merged
yves-biener merged 20 commits from own-tty-visuals into main 2024-11-13 19:52:55 +01:00
2 changed files with 6 additions and 4 deletions
Showing only changes of commit ba01bf00bb - Show all commits

View File

@@ -54,10 +54,9 @@ pub fn Layout(comptime Event: type) type {
}
pub fn content(this: *@This()) !*std.ArrayList(u8) {
const widget_content = try this.widget.content();
this.c.clearRetainingCapacity();
try this.c.appendSlice("\n");
try this.c.appendSlice(widget_content);
try this.c.appendSlice(try this.widget.content());
try this.c.appendSlice("\n");
return &this.c;
}

View File

@@ -39,6 +39,9 @@ pub fn Widget(comptime Event: type) type {
// store the received size
.resize => |size| {
this.size = size;
if (this.line > this.line_index.items.len - 1 - size.rows) {
this.line = this.line_index.items.len - 1 - size.rows;
}
},
.key => |key| {
if (key.matches(.{ .cp = 'g' })) {
@@ -47,11 +50,11 @@ pub fn Widget(comptime Event: type) type {
}
if (key.matches(.{ .cp = 'G' })) {
// bottom
this.line = this.line_index.items.len - 1;
this.line = this.line_index.items.len - 1 - this.size.rows;
}
if (key.matches(.{ .cp = 'j' })) {
// down
if (this.line < this.line_index.items.len - 1) {
if (this.line < this.line_index.items.len - 1 - this.size.rows) {
this.line +|= 1;
}
}