mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
apprt/embedded: clipboard value can be null
This commit is contained in:
@ -45,8 +45,9 @@ pub const App = struct {
|
||||
set_title: *const fn (SurfaceUD, [*]const u8) callconv(.C) void,
|
||||
|
||||
/// Read the clipboard value. The return value must be preserved
|
||||
/// by the host until the next call.
|
||||
read_clipboard: *const fn (SurfaceUD) callconv(.C) [*:0]const u8,
|
||||
/// by the host until the next call. If there is no valid clipboard
|
||||
/// value then this should return null.
|
||||
read_clipboard: *const fn (SurfaceUD) callconv(.C) ?[*:0]const u8,
|
||||
|
||||
/// Write the clipboard value.
|
||||
write_clipboard: *const fn (SurfaceUD, [*:0]const u8) callconv(.C) void,
|
||||
@ -228,7 +229,7 @@ pub const Surface = struct {
|
||||
}
|
||||
|
||||
pub fn getClipboardString(self: *const Surface) ![:0]const u8 {
|
||||
const ptr = self.app.opts.read_clipboard(self.opts.userdata);
|
||||
const ptr = self.app.opts.read_clipboard(self.opts.userdata) orelse return "";
|
||||
return std.mem.sliceTo(ptr, 0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user