diff options
Diffstat (limited to 'core/Term.zig')
| -rw-r--r-- | core/Term.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/Term.zig b/core/Term.zig index 116c1118..fde36420 100644 --- a/core/Term.zig +++ b/core/Term.zig @@ -79,8 +79,8 @@ pub const State = struct { } /// What `dumpRead` made, freed: a load that failed after it. - pub fn dumpFree(s: *State, gpa: std.mem.Allocator) void { - the().close(s.impl, gpa); + pub fn dumpFree(s: *State, _: std.mem.Allocator) void { + the().close(s.impl); } pub fn dumpRead(out: *State, gpa: std.mem.Allocator, bytes: []const u8) !void { @@ -115,10 +115,11 @@ pub fn open(gpa: std.mem.Allocator, cols: u16, rows: u16) !*State { return s; } -/// It and what it holds, freed; the kitty images' caches were `gpa`'s. -pub fn close(s: *State, gpa: std.mem.Allocator) void { +/// It and what it holds, freed, all of it with its own allocator (the +/// one it was opened with): the allocator a caller hands is not used. +pub fn close(s: *State, _: std.mem.Allocator) void { const own = the().gpa(s.impl); - the().close(s.impl, gpa); + the().close(s.impl); own.destroy(s); } @@ -288,14 +289,14 @@ pub fn editRows(s: *State, arena: std.mem.Allocator, first: usize, count: usize) /// How many bytes of one of its rows, as `viewport` and `textRows` give it /// uncut, are the prompt it starts with: the prompt's columns, measured in /// the row's text as the core measures a display. -pub fn promptPrefix(s: ?*State, row: i32, raw: []const u8) usize { +pub fn promptPrefix(tab: u16, s: ?*State, row: i32, raw: []const u8) usize { const state = s orelse return 0; if (row < 0) return 0; const cut = the().promptCut(state.impl, row) orelse return 0; return switch (cut) { .keep => 0, .blank => raw.len, - .cut => |cols| @min(raw.len, File.rawAtDisplay(raw, cols)), + .cut => |cols| @min(raw.len, File.rawAtDisplay(tab, raw, cols)), }; } |
