raw.go
This file
Path
raw.go
37 lines · 967 bytes · Go
Last changed by
Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
History of this fileTake it
1package tea23// RawMsg is a message that contains a string to be printed to the terminal4// without any intermediate processing.5type RawMsg struct {6 Msg any7}89// Raw is a command that prints the given string to the terminal without any10// formatting.11//12// This is intended for advanced use cases where you need to query the terminal13// or send escape sequences directly. Don't use this unless you know what14// you're doing :)15//16// Example:17//18// func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {19// switch msg := msg.(type) {20// case input.PrimaryDeviceAttributesEvent:21// for _, attr := range msg {22// if attr == 4 {23// // We have Sixel graphics support!24// break25// }26// }27// }28//29// // Request the terminal primary device attributes to detect Sixel graphics30// // support.31// return m, tea.Raw(ansi.RequestPrimaryDeviceAttributes)32// }33func Raw(r any) Cmd {34 return func() Msg {35 return RawMsg{r}36 }37}