From daf8886999641e9d7b89291e626f0da4d05d1442 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Tue, 28 Dec 2021 20:30:42 +0200 Subject: Added more build-time config --- src/Buffer.zig | 8 ++++++-- src/Config.zig | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Buffer.zig b/src/Buffer.zig index d7f051d..cb89935 100644 --- a/src/Buffer.zig +++ b/src/Buffer.zig @@ -1,4 +1,4 @@ -const es_config = @import("es-config"); +const conf = @import("es-config"); const std = @import("std"); const Allocator = std.mem.Allocator; @@ -193,7 +193,11 @@ pub fn drawRows(self: Buffer, writer: anytype, screenrows: usize, screencols: us } } } else if (self.rows.items.len == 0 and y == screenrows / 3) { - const welcome_data = try std.fmt.allocPrint(self.allocator, "ES -- version {}", .{es_config.es_version}); + const welcome_data = try std.fmt.allocPrint( + self.allocator, + "ES -- version {}", + .{conf.es_version}, + ); defer self.allocator.free(welcome_data); var welcome = welcome_data; if (welcome.len > screencols - 1) { diff --git a/src/Config.zig b/src/Config.zig index 1f11b65..900c2aa 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -1,5 +1,6 @@ // TODO: Change this to proper TOML in the future :) +const conf = @import("es-config"); const std = @import("std"); const Allocator = std.mem.Allocator; @@ -8,9 +9,9 @@ const Config = @This(); const config_path = "arkta/es/es.ini"; -line_limit: usize = 100, -page_overlap: usize = 2, -tab_stop: usize = 8, +line_limit: usize = conf.default_line_limit, +page_overlap: usize = conf.default_page_overlap, +tab_stop: usize = conf.default_tab_stop, pub fn readConfig(allocator: Allocator) !Config { var config = Config{}; -- cgit v1.2.3