aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/c/selection.zig
blob: 74e96598fe482cceb5b1ef744eb838e3edcbe9ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const grid_ref = @import("grid_ref.zig");
const Selection = @import("../Selection.zig");

/// C: GhosttySelection
pub const CSelection = extern struct {
    size: usize = @sizeOf(CSelection),
    start: grid_ref.CGridRef,
    end: grid_ref.CGridRef,
    rectangle: bool = false,

    pub fn toZig(self: CSelection) ?Selection {
        const start_pin = self.start.toPin() orelse return null;
        const end_pin = self.end.toPin() orelse return null;
        return Selection.init(start_pin, end_pin, self.rectangle);
    }
};