Add custom layout creation.
This commit is contained in:
+9
-2
@@ -54,7 +54,14 @@ on_focus: *const fn (ctx: ?*anyopaque) void,
|
||||
|
||||
ctx: ?*anyopaque = null,
|
||||
|
||||
pub fn create(alloc: std.mem.Allocator, cbs: Pane.Callbacks) !*Terminal {
|
||||
/// What a layout can specify for a terminal pane.
|
||||
pub const Options = Session.Options;
|
||||
|
||||
pub fn create(
|
||||
alloc: std.mem.Allocator,
|
||||
opts: Options,
|
||||
cbs: Pane.Callbacks,
|
||||
) !*Terminal {
|
||||
const self = try alloc.create(Terminal);
|
||||
errdefer alloc.destroy(self);
|
||||
|
||||
@@ -76,7 +83,7 @@ pub fn create(alloc: std.mem.Allocator, cbs: Pane.Callbacks) !*Terminal {
|
||||
|
||||
// The grid size follows the widget size, but we need a starting point
|
||||
// for the session before the widget has ever been allocated.
|
||||
self.session = try .create(alloc, 80, 24, .{
|
||||
self.session = try .create(alloc, 80, 24, opts, .{
|
||||
.on_damage = &onDamage,
|
||||
.on_title = &onSessionTitle,
|
||||
.on_exit = &onSessionExit,
|
||||
|
||||
Reference in New Issue
Block a user