feat: BREAKING make highlight_columns a list of integers

This commit is contained in:
CJ van den Berg 2025-07-16 19:40:42 +02:00
parent 46dfde7685
commit 30c6ac0e82
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 1 additions and 17 deletions

View file

@ -10,7 +10,7 @@ enable_terminal_cursor: bool = true,
enable_terminal_color_scheme: bool = builtin.os.tag != .windows,
highlight_current_line: bool = true,
highlight_current_line_gutter: bool = true,
highlight_columns: []const u8 = "80 100 120",
highlight_columns: []const u16 = &.{ 80, 100, 120 },
highlight_columns_alpha: u8 = 240,
highlight_columns_enabled: bool = false,
whitespace_mode: []const u8 = "none",

View file

@ -119,15 +119,6 @@ fn init(allocator: Allocator) InitError!*Self {
const frame_time = std.time.us_per_s / conf.frame_rate;
const frame_clock = try tp.metronome.init(frame_time);
const hl_cols: usize = blk: {
var it = std.mem.splitScalar(u8, conf.highlight_columns, ' ');
var idx: usize = 0;
while (it.next()) |_|
idx += 1;
break :blk idx;
};
const highlight_columns__ = try allocator.alloc(u16, hl_cols);
var self = try allocator.create(Self);
self.* = .{
.allocator = allocator,
@ -154,13 +145,6 @@ fn init(allocator: Allocator) InitError!*Self {
instance_ = self;
defer instance_ = null;
var it = std.mem.splitScalar(u8, conf.highlight_columns, ' ');
var idx: usize = 0;
while (it.next()) |arg| {
highlight_columns__[idx] = std.fmt.parseInt(u16, arg, 10) catch 0;
idx += 1;
}
self.default_cursor = std.meta.stringToEnum(keybind.CursorShape, conf.default_cursor) orelse .default;
self.config_.default_cursor = @tagName(self.default_cursor);
self.rdr_.handler_ctx = self;