mod(pane) example layout pane has top and bottom empty row
Fix corresponding RawText line control (i.e. last line and changes to the window size in regards to the current line).
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user