Compare commits
No commits in common. "1d509282f7e551de5d615eb21c35fb2d36af6185" and "2fe12a050ef8d29aa40d05b5b9ccae066843dd64" have entirely different histories.
1d509282f7
...
2fe12a050e
2 changed files with 3 additions and 30 deletions
|
|
@ -83,8 +83,6 @@ pub fn main() anyerror!void {
|
|||
.literal = "Disable :LINE and +LINE syntax",
|
||||
.scratch = "Open a scratch (temporary) buffer on start",
|
||||
.new_file = "Create a new untitled file on start",
|
||||
.dark = "Use dark color scheme",
|
||||
.light = "Use light color scheme",
|
||||
.version = "Show build version and exit",
|
||||
};
|
||||
|
||||
|
|
@ -123,8 +121,6 @@ pub fn main() anyerror!void {
|
|||
literal: bool,
|
||||
scratch: bool,
|
||||
new_file: bool,
|
||||
dark: bool,
|
||||
light: bool,
|
||||
version: bool,
|
||||
|
||||
positional: struct {
|
||||
|
|
@ -350,11 +346,6 @@ pub fn main() anyerror!void {
|
|||
try tui_proc.send(.{ "cmd", "create_scratch_buffer", .{} });
|
||||
}
|
||||
|
||||
if (args.dark)
|
||||
try tui_proc.send(.{ "cmd", "force_color_scheme", .{"dark"} })
|
||||
else if (args.light)
|
||||
try tui_proc.send(.{ "cmd", "force_color_scheme", .{"light"} });
|
||||
|
||||
if (args.exec) |exec_str| {
|
||||
var cmds = std.mem.splitScalar(u8, exec_str, ';');
|
||||
while (cmds.next()) |cmd| {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ query_cache_: *syntax.QueryCache,
|
|||
frames_rendered_: usize = 0,
|
||||
clipboard: ?[]const u8 = null,
|
||||
color_scheme: enum { dark, light } = .dark,
|
||||
color_scheme_locked: bool = false,
|
||||
|
||||
const keepalive = std.time.us_per_day * 365; // one year
|
||||
const idle_frames = 0;
|
||||
|
|
@ -787,14 +786,7 @@ fn set_theme_by_name(self: *Self, name: []const u8, action: enum { none, store }
|
|||
}
|
||||
}
|
||||
|
||||
fn force_color_scheme(self: *Self, color_scheme: @TypeOf(self.color_scheme)) void {
|
||||
self.color_scheme = color_scheme;
|
||||
self.color_scheme_locked = true;
|
||||
self.logger.print("color scheme: {s} ({s})", .{ @tagName(self.color_scheme), self.current_theme().name });
|
||||
}
|
||||
|
||||
fn set_color_scheme(self: *Self, color_scheme: @TypeOf(self.color_scheme)) void {
|
||||
if (self.color_scheme_locked) return;
|
||||
self.color_scheme = color_scheme;
|
||||
self.logger.print("color scheme: {s} ({s})", .{ @tagName(self.color_scheme), self.current_theme().name });
|
||||
}
|
||||
|
|
@ -921,28 +913,18 @@ const cmds = struct {
|
|||
}
|
||||
pub const toggle_highlight_columns_meta: Meta = .{ .description = "Toggle highlight columns" };
|
||||
|
||||
pub fn force_color_scheme(self: *Self, ctx: Ctx) Result {
|
||||
self.force_color_scheme(if (try ctx.args.match(.{"dark"}))
|
||||
.dark
|
||||
else if (try ctx.args.match(.{"light"}))
|
||||
.light
|
||||
else
|
||||
.dark);
|
||||
}
|
||||
pub const force_color_scheme_meta: Meta = .{ .arguments = &.{.string} };
|
||||
|
||||
pub fn set_color_scheme(self: *Self, ctx: Ctx) Result {
|
||||
self.force_color_scheme(if (try ctx.args.match(.{"dark"}))
|
||||
self.set_color_scheme(if (try ctx.args.match(.{"dark"}))
|
||||
.dark
|
||||
else if (try ctx.args.match(.{"light"}))
|
||||
.light
|
||||
else
|
||||
.dark);
|
||||
}
|
||||
pub const set_color_scheme_meta: Meta = .{ .arguments = &.{.string} };
|
||||
pub const set_color_scheme_meta: Meta = .{ .description = "Toggle dark/light color scheme" };
|
||||
|
||||
pub fn toggle_color_scheme(self: *Self, _: Ctx) Result {
|
||||
self.force_color_scheme(switch (self.color_scheme) {
|
||||
self.set_color_scheme(switch (self.color_scheme) {
|
||||
.dark => .light,
|
||||
.light => .dark,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue