tea_init.go 712 B

12345678910111213141516171819202122
  1. package tea
  2. import (
  3. "github.com/charmbracelet/lipgloss"
  4. )
  5. func init() {
  6. // XXX: This is a workaround to make assure that Lip Gloss and Termenv
  7. // query the terminal before any Bubble Tea Program runs and acquires the
  8. // terminal. Without this, Programs that use Lip Gloss/Termenv might hang
  9. // while waiting for a a [termenv.OSCTimeout] while querying the terminal
  10. // for its background/foreground colors.
  11. //
  12. // This happens because Bubble Tea acquires the terminal before termenv
  13. // reads any responses.
  14. //
  15. // Note that this will only affect programs running on the default IO i.e.
  16. // [os.Stdout] and [os.Stdin].
  17. //
  18. // This workaround will be removed in v2.
  19. _ = lipgloss.HasDarkBackground()
  20. }