From 72e88ba6a34d0c6d3416c3f1c12ea2d72c1d4b34 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 11 Dec 2024 20:44:11 +0100 Subject: [PATCH] refactor: no need to force const on allocated return values --- src/tui/editor.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 658cf96..92ee1b5 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -1993,14 +1993,14 @@ pub const Editor = struct { tui.current().rdr.copy_to_system_clipboard(text); } - fn copy_selection(root: Buffer.Root, sel: Selection, text_allocator: Allocator, metrics: Buffer.Metrics) ![]const u8 { + fn copy_selection(root: Buffer.Root, sel: Selection, text_allocator: Allocator, metrics: Buffer.Metrics) ![]u8 { var size: usize = 0; _ = try root.get_range(sel, null, &size, null, metrics); const buf__ = try text_allocator.alloc(u8, size); return (try root.get_range(sel, buf__, null, null, metrics)).?; } - pub fn get_selection(self: *const Self, sel: Selection, text_allocator: Allocator) ![]const u8 { + pub fn get_selection(self: *const Self, sel: Selection, text_allocator: Allocator) ![]u8 { return copy_selection(try self.buf_root(), sel, text_allocator, self.metrics); }