From bd62dfcdc1f62ef0d2059acf9b369f6dbdb412e2 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 28 Oct 2024 19:45:13 +0100 Subject: [PATCH] fix: add missing system_paste support to file_browser --- src/tui/mode/mini/file_browser.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tui/mode/mini/file_browser.zig b/src/tui/mode/mini/file_browser.zig index efe97fb..42f6519 100644 --- a/src/tui/mode/mini/file_browser.zig +++ b/src/tui/mode/mini/file_browser.zig @@ -73,7 +73,12 @@ pub fn Create(options: type) type { self.allocator.destroy(self); } - pub fn receive(self: *Self, _: tp.pid_ref, _: tp.message) error{Exit}!bool { + pub fn receive(self: *Self, _: tp.pid_ref, m: tp.message) error{Exit}!bool { + var text: []const u8 = undefined; + + if (try m.match(.{ "system_clipboard", tp.extract(&text) })) { + self.file_path.appendSlice(text) catch |e| return tp.exit_error(e, @errorReturnTrace()); + } self.update_mini_mode_text(); return false; }