options: allow applications to set requested kitty flags
This commit is contained in:
parent
972129a764
commit
cce22e8850
1 changed files with 9 additions and 3 deletions
|
@ -14,6 +14,7 @@ const Unicode = @import("Unicode.zig");
|
||||||
const Window = @import("Window.zig");
|
const Window = @import("Window.zig");
|
||||||
|
|
||||||
const Hyperlink = Cell.Hyperlink;
|
const Hyperlink = Cell.Hyperlink;
|
||||||
|
const KittyFlags = Key.KittyFlags;
|
||||||
const Shape = Mouse.Shape;
|
const Shape = Mouse.Shape;
|
||||||
const Style = Cell.Style;
|
const Style = Cell.Style;
|
||||||
const Winsize = Tty.Winsize;
|
const Winsize = Tty.Winsize;
|
||||||
|
@ -32,7 +33,9 @@ pub const Capabilities = struct {
|
||||||
unicode: gwidth.Method = .wcwidth,
|
unicode: gwidth.Method = .wcwidth,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Options = struct {};
|
pub const Options = struct {
|
||||||
|
kitty_keyboard_flags: KittyFlags = .{},
|
||||||
|
};
|
||||||
|
|
||||||
tty: ?Tty,
|
tty: ?Tty,
|
||||||
|
|
||||||
|
@ -44,6 +47,8 @@ screen_last: InternalScreen = undefined,
|
||||||
|
|
||||||
caps: Capabilities = .{},
|
caps: Capabilities = .{},
|
||||||
|
|
||||||
|
opts: Options = .{},
|
||||||
|
|
||||||
/// if we should redraw the entire screen on the next render
|
/// if we should redraw the entire screen on the next render
|
||||||
refresh: bool = false,
|
refresh: bool = false,
|
||||||
|
|
||||||
|
@ -67,8 +72,9 @@ sgr: enum {
|
||||||
} = .standard,
|
} = .standard,
|
||||||
|
|
||||||
/// Initialize Vaxis with runtime options
|
/// Initialize Vaxis with runtime options
|
||||||
pub fn init(alloc: std.mem.Allocator, _: Options) !Vaxis {
|
pub fn init(alloc: std.mem.Allocator, opts: Options) !Vaxis {
|
||||||
return .{
|
return .{
|
||||||
|
.opts = opts,
|
||||||
.tty = null,
|
.tty = null,
|
||||||
.screen = .{},
|
.screen = .{},
|
||||||
.screen_last = .{},
|
.screen_last = .{},
|
||||||
|
@ -211,7 +217,7 @@ pub fn queryTerminal(self: *Vaxis) !void {
|
||||||
|
|
||||||
// enable detected features
|
// enable detected features
|
||||||
if (self.caps.kitty_keyboard) {
|
if (self.caps.kitty_keyboard) {
|
||||||
try self.enableKittyKeyboard(.{});
|
try self.enableKittyKeyboard(self.opts.kitty_keyboard_flags);
|
||||||
}
|
}
|
||||||
if (self.caps.unicode == .unicode) {
|
if (self.caps.unicode == .unicode) {
|
||||||
_ = try tty.write(ctlseqs.unicode_set);
|
_ = try tty.write(ctlseqs.unicode_set);
|
||||||
|
|
Loading…
Reference in a new issue