summaryrefslogtreecommitdiff
path: root/src/Buffer.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Buffer.zig')
-rw-r--r--src/Buffer.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Buffer.zig b/src/Buffer.zig
index 7f3043b..5bf319c 100644
--- a/src/Buffer.zig
+++ b/src/Buffer.zig
@@ -274,8 +274,8 @@ pub fn forwardChar(self: *Buffer) void {
274 274
275// TODO: Make use of the callback feature to go to the final line while typing in. 275// TODO: Make use of the callback feature to go to the final line while typing in.
276pub fn goToLine(self: *Buffer, editor: *Editor) !void { 276pub fn goToLine(self: *Buffer, editor: *Editor) !void {
277 if (try editor.prompt("Goto line")) |line_str| { 277 if (try editor.prompt(self.allocator, "Goto line")) |line_str| {
278 defer editor.allocator.free(line_str); 278 defer self.allocator.free(line_str);
279 279
280 const line = std.fmt.parseUnsigned(usize, line_str, 0) catch |err| { 280 const line = std.fmt.parseUnsigned(usize, line_str, 0) catch |err| {
281 try editor.setStatusMessage("Couldn't parse '{s}' as an integer: {}", .{ line_str, err }); 281 try editor.setStatusMessage("Couldn't parse '{s}' as an integer: {}", .{ line_str, err });
@@ -434,8 +434,7 @@ pub fn recenterTopBottom(self: *Buffer, screenrows: usize) void {
434 434
435pub fn save(self: *Buffer, editor: *Editor) !void { 435pub fn save(self: *Buffer, editor: *Editor) !void {
436 if (self.file_path == null) { 436 if (self.file_path == null) {
437 // TODO: Editor.prompt should take an Allocator 437 const fname = (try editor.prompt(self.allocator, "Save as")) orelse { return; };
438 const fname = (try editor.prompt("Save as")) orelse { return; };
439 defer self.allocator.free(fname); 438 defer self.allocator.free(fname);
440 439
441 const file_path = try es.files.resolvePath(self.allocator, fname); 440 const file_path = try es.files.resolvePath(self.allocator, fname);