Replace vaxis with zterm #1
@@ -54,10 +54,9 @@ pub fn Layout(comptime Event: type) type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn content(this: *@This()) !*std.ArrayList(u8) {
|
pub fn content(this: *@This()) !*std.ArrayList(u8) {
|
||||||
const widget_content = try this.widget.content();
|
|
||||||
this.c.clearRetainingCapacity();
|
this.c.clearRetainingCapacity();
|
||||||
try this.c.appendSlice("\n");
|
try this.c.appendSlice("\n");
|
||||||
try this.c.appendSlice(widget_content);
|
try this.c.appendSlice(try this.widget.content());
|
||||||
try this.c.appendSlice("\n");
|
try this.c.appendSlice("\n");
|
||||||
return &this.c;
|
return &this.c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ pub fn Widget(comptime Event: type) type {
|
|||||||
// store the received size
|
// store the received size
|
||||||
.resize => |size| {
|
.resize => |size| {
|
||||||
this.size = 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| {
|
.key => |key| {
|
||||||
if (key.matches(.{ .cp = 'g' })) {
|
if (key.matches(.{ .cp = 'g' })) {
|
||||||
@@ -47,11 +50,11 @@ pub fn Widget(comptime Event: type) type {
|
|||||||
}
|
}
|
||||||
if (key.matches(.{ .cp = 'G' })) {
|
if (key.matches(.{ .cp = 'G' })) {
|
||||||
// bottom
|
// 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' })) {
|
if (key.matches(.{ .cp = 'j' })) {
|
||||||
// down
|
// 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;
|
this.line +|= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user