raw.go

 1package tea
 2
 3// RawMsg is a message that contains a string to be printed to the terminal
 4// without any intermediate processing.
 5type RawMsg struct {
 6	Msg any
 7}
 8
 9// Raw is a command that prints the given string to the terminal without any
10// formatting.
11//
12// This is intended for advanced use cases where you need to query the terminal
13// or send escape sequences directly. Don't use this unless you know what
14// 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//	        break
25//	      }
26//	    }
27//	  }
28//
29//	  // Request the terminal primary device attributes to detect Sixel graphics
30//	  // support.
31//	  return m, tea.Raw(ansi.RequestPrimaryDeviceAttributes)
32//	}
33func Raw(r any) Cmd {
34	return func() Msg {
35		return RawMsg{r}
36	}
37}