From 6845c3a542609fcff1a1aa97dfda4fefbc50fb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Wed, 15 Jul 2026 12:05:34 +0200 Subject: [PATCH] agent: use decl-literal init syntax in picker and prompt_assist --- src/agent/picker.zig | 8 ++++---- src/agent/prompt_assist.zig | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/agent/picker.zig b/src/agent/picker.zig index b6a7485eb..09604e4b2 100644 --- a/src/agent/picker.zig +++ b/src/agent/picker.zig @@ -132,10 +132,10 @@ const RawTerminal = struct { }; fn promptInteractiveChoice(header: []const u8, items: []const [:0]const u8, default: ?usize) !usize { - var raw = try RawTerminal.enable(); + var raw: RawTerminal = try .enable(); defer raw.restore(); - var state = ChoiceState.init(default); + var state: ChoiceState = .init(default); const line_count = items.len + 2; var first_render = true; while (true) { @@ -219,7 +219,7 @@ fn readChoiceByte() !?u8 { } test "ChoiceState: arrows wrap and enter selects highlighted item" { - var state = ChoiceState.init(null); + var state: ChoiceState = .init(null); try std.testing.expectEqual(@as(usize, 0), state.selected); try std.testing.expectEqual(@as(?usize, null), state.apply(.up, 3)); @@ -232,7 +232,7 @@ test "ChoiceState: arrows wrap and enter selects highlighted item" { } test "ChoiceState: starts on default and enter returns it" { - var state = ChoiceState.init(2); + var state: ChoiceState = .init(2); try std.testing.expectEqual(@as(usize, 2), state.selected); try std.testing.expectEqual(@as(?usize, 2), state.apply(.enter, 3)); } diff --git a/src/agent/prompt_assist.zig b/src/agent/prompt_assist.zig index cc5b796ad..ab82f8320 100644 --- a/src/agent/prompt_assist.zig +++ b/src/agent/prompt_assist.zig @@ -436,7 +436,7 @@ fn addPathCompletions( prefix: []const u8, buf: *[completion_buf_len:0]u8, ) void { - var matches = PathMatchIterator.init(body) orelse return; + var matches: PathMatchIterator = .init(body) orelse return; defer matches.deinit(); var name_buf: [completion_buf_len]u8 = undefined; @@ -613,7 +613,7 @@ fn renderMetaHint(state: *State, meta: *const SlashCommand.MetaCommand, body: [] /// Ghosts the first filesystem entry that completes the partial path `body`. fn ghostPathFirstMatch(body: []const u8) [*c]const u8 { - var matches = PathMatchIterator.init(body) orelse return null; + var matches: PathMatchIterator = .init(body) orelse return null; defer matches.deinit(); const m = matches.next() orelse return null; const suffix: []const u8 = if (m.is_dir) "/" else "";