Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func NewTerminal(opts ...TerminalOption) (*Terminal, error) {
C.ghostty_terminal_set(
t.ptr,
C.GHOSTTY_TERMINAL_OPT_USERDATA,
unsafe.Pointer(t.handle),
handleToPointer(t.handle),
)

// Register any effects that were provided via options.
Expand Down Expand Up @@ -408,3 +408,13 @@ func (t *Terminal) GridRef(point Point) (*GridRef, error) {
}
return &GridRef{ref: ref}, nil
}

// handleToPointer converts a cgo.Handle (uintptr) to unsafe.Pointer
// for passing as C userdata. The handle is an opaque integer, not a
// real Go pointer, so we suppress checkptr which would otherwise
// reject it under -race.
//
//go:nocheckptr
func handleToPointer(h cgo.Handle) unsafe.Pointer {
return unsafe.Pointer(h)
}