From fecea5d7a74f97d41c50734349c80062ce2e9cb6 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Tue, 21 Dec 2021 07:06:13 +0200 Subject: zig fmt --- src/Editor.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/Editor.zig') diff --git a/src/Editor.zig b/src/Editor.zig index eecbaa7..487c5ff 100644 --- a/src/Editor.zig +++ b/src/Editor.zig @@ -188,7 +188,7 @@ pub fn promptEx( defer buf.deinit(); while (true) { - try self.setStatusMessage("{s}: {s}", .{prompt_str, buf.items}); + try self.setStatusMessage("{s}: {s}", .{ prompt_str, buf.items }); try self.refreshScreen(); // TODO: Navigation @@ -217,7 +217,7 @@ pub fn promptEx( if (std.ascii.isSpace(key_char) or std.ascii.isGraph(key_char)) { try buf.append(key_char); } - } // else ?? + }, // else ?? } if (callback) |cb| { @@ -227,7 +227,7 @@ pub fn promptEx( } pub fn PromptCallback(comptime Data: type, comptime Error: type) type { - return fn(*Editor, []const u8, Key, Data) Error!void; + return fn (*Editor, []const u8, Key, Data) Error!void; } pub fn promptYN(self: *Editor, prompt_str: []const u8) !bool { @@ -237,8 +237,7 @@ pub fn promptYN(self: *Editor, prompt_str: []const u8) !bool { var response = try self.prompt(full_prompt); defer if (response) |str| self.allocator.free(str); // TODO: This can be improved - while (response == null - or (response.?[0] != 'y' and response.?[0] != 'Y' and response.?[0] != 'n' and response.?[0] != 'N')) { + while (response == null or (response.?[0] != 'y' and response.?[0] != 'Y' and response.?[0] != 'n' and response.?[0] != 'N')) { if (response) |str| self.allocator.free(str); response = try self.prompt(full_prompt); } @@ -342,7 +341,7 @@ fn getCursorPosition(row: *usize, col: *usize) !void { try std_out.writeAll("\x1b[6n\r\n"); const std_in = std.io.getStdIn().reader(); - var buf = [_]u8 { undefined } ** 32; + var buf = [_]u8{undefined} ** 32; var response = std_in.readUntilDelimiter(&buf, 'R') catch |err| switch (err) { error.EndOfStream => return error.MisformedTerminalResponse, error.StreamTooLong => return error.MisformedTerminalResponse, -- cgit v1.2.3