summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Editor.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Editor.zig b/src/Editor.zig
index 487c5ff..4d45b77 100644
--- a/src/Editor.zig
+++ b/src/Editor.zig
@@ -237,7 +237,13 @@ pub fn promptYN(self: *Editor, prompt_str: []const u8) !bool {
237 var response = try self.prompt(full_prompt); 237 var response = try self.prompt(full_prompt);
238 defer if (response) |str| self.allocator.free(str); 238 defer if (response) |str| self.allocator.free(str);
239 // TODO: This can be improved 239 // TODO: This can be improved
240 while (response == null or (response.?[0] != 'y' and response.?[0] != 'Y' and response.?[0] != 'n' and response.?[0] != 'N')) { 240 while (response == null
241 or response.?.len == 0
242 or (response.?[0] != 'y'
243 and response.?[0] != 'Y'
244 and response.?[0] != 'n'
245 and response.?[0] != 'N')
246 ) {
241 if (response) |str| self.allocator.free(str); 247 if (response) |str| self.allocator.free(str);
242 response = try self.prompt(full_prompt); 248 response = try self.prompt(full_prompt);
243 } 249 }