Skip to content

Commit

Permalink
fix(telnet): Disable fullscreen/ mouse if no profile was received
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 22, 2024
1 parent e08aa54 commit 54a7bb7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions internal/server/telnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,26 @@ func (s *TelnetServer) Handler(ctx context.Context, conn net.Conn, m *movie.Movi
cancel()
}()

var gotProfile bool
var profile termenv.Profile
select {
case term := <-termCh:
profile = util.Profile(term)
gotProfile = true
case <-time.After(time.Second):
profile = termenv.ANSI256
}

player := movie.NewPlayer(m, logger, telnet.MakeRenderer(outW, profile))
program := tea.NewProgram(
player,
opts := []tea.ProgramOption{
tea.WithInput(inR),
tea.WithOutput(outW),
tea.WithFPS(30),
tea.WithAltScreen(),
tea.WithMouseCellMotion(),
)
}
if gotProfile {
opts = append(opts, tea.WithAltScreen(), tea.WithMouseCellMotion())
}
program := tea.NewProgram(player, opts...)

go func() {
for {
Expand Down

0 comments on commit 54a7bb7

Please sign in to comment.