authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-01 11:56:23 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-01 11:56:23 -07:00
log00f5c71e9dda6c35d478aead9da569c02f3f8db0
tree699cf386d7e01092129fa98de301a59e9d171bd1
parentd36621903868136b2ce347e9be9c937e664e1e74

trimRight any extra CR/LF for windows users


1 files changed, 2 insertions(+), 1 deletions(-)

src/lib.zig+2-1
......@@ -19,7 +19,8 @@ fn doprompt(out: anytype, in: anytype, alloc: *std.mem.Allocator, default: ?[]co
1919 var value: []const u8 = undefined;
2020 while (true) : (n += 1) {
2121 try out.print(comptime ansi.color.Faint("> "), .{});
22 const input = try in.readUntilDelimiterAlloc(alloc, '\n', 100);
22 var input: []const u8 = try in.readUntilDelimiterAlloc(alloc, '\n', 100);
23 input = std.mem.trimRight(u8, input, "\r\n");
2324
2425 if (input.len == 0) if (default) |d| {
2526 value = d;