Repository: charmbracelet/bubbletea
File: tea.go (Go)

Code before:
	// events.
	ReportFocus bool

	// DisableBracketedPasteMode disables bracketed paste mode for this view.
	DisableBracketedPasteMode bool

	// MouseMode sets the mouse mode for this view. It can be one of
	// [MouseModeNone], [MouseModeCellMotion], or [MouseModeAllMotion].
	MouseMode MouseMode

	// KeyboardEnhancements describes what keyboard enhancement features Bubble
	// Tea should request from the terminal.
	// If the terminal supports any of them, it will respond with a
	// [KeyboardEnhancementsMsg] that indicates which features are supported.
	KeyboardEnhancements KeyboardEnhancements
}

// KeyboardEnhancements describes the requested keyboard enhancement features.
// If the terminal supports any of them, it will respond with a
// [KeyboardEnhancementsMsg] that indicates which features are supported.

// KeyboardEnhancements defines different keyboard enhancement features that
// can be requested from the terminal.
type KeyboardEnhancements struct {
	// ReportEventTypes requests the terminal to report key repeat and release
	// events.
	// If supported, your program will receive [KeyReleaseMsg]s and
	// [KeyPressMsg] with the [Key.IsRepeat] field set indicating that this is
	// a it's part of a key repeat sequence.
	ReportEventTypes bool
}

// SetContent sets the content of the view to the value.
func (v *View) SetContent(s any) {
	switch vi := s.(type) {
	case string:
		v.Layer = uv.NewStyledString(vi)
	case fmt.Stringer:
		v.Layer = uv.NewStyledString(vi.String())
	case Layer:
		v.Layer = vi
	default:
		v.Layer = uv.NewStyledString(fmt.Sprintf("%v", vi))
	}
}

// MouseMode represents the mouse mode of a view.
type MouseMode int

const (
	// MouseModeNone disables mouse events.

Review comment (suggestion):
We should probably say that this is sent automatically on start and show an example of how to listen for it.

Code after:
	// events.
	ReportFocus bool

	// DisableBracketedPasteMode disables bracketed paste mode for this view.
	DisableBracketedPasteMode bool

	// MouseMode sets the mouse mode for this view. It can be one of
	// [MouseModeNone], [MouseModeCellMotion], or [MouseModeAllMotion].
	MouseMode MouseMode

	// KeyboardEnhancements describes what keyboard enhancement features Bubble
	// Tea should request from the terminal.
	//
	// Bubble Tea supports requesting the following keyboard enhancement features:
	//   - ReportEventTypes: requests the terminal to report key repeat and
	//     release events.
	//
	// If the terminal supports any of these features, your program will
	// receive  a [KeyboardEnhancementsMsg] that indicates which features are
	// available.
	KeyboardEnhancements KeyboardEnhancements
}

// KeyboardEnhancements describes the requested keyboard enhancement features.
// If the terminal supports any of them, it will respond with a
// [KeyboardEnhancementsMsg] that indicates which features are supported.

// KeyboardEnhancements defines different keyboard enhancement features that
// can be requested from the terminal.

// KeyboardEnhancements defines different keyboard enhancement features that
// can be requested from the terminal.
//
// By default, Bubble Tea requests basic key disambiguation features from the
// terminal. If the terminal supports keyboard enhancements, or any of its
// additional features, it will respond with a [KeyboardEnhancementsMsg] that
// indicates which features are supported.
//
// Example:
//
//	```go
//	func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
//	  switch msg := msg.(type) {
//	  case tea.KeyboardEnhancementsMsg:
//	    // We have basic key disambiguation support.
//	    // We can handle "shift+enter", "ctrl+i", etc.
//		m.keyboardEnhancements = msg
//		if msg.ReportEventTypes {
//		  // Even better! We can now handle key repeat and release events.
//		}
//	  case tea.KeyPressMsg: