Skip to content

Commit

Permalink
Revert "Use tmux as TERM if TERM is screen but TMUX env is set"
Browse files Browse the repository at this point in the history
Forcing TERM to tmux can cause problems, because often "tmux" terminfo is unavailable, which is why tmux defaults to "screen". The tmux FAQ explicitly mentions that tmux uses "screen" by default because it is widely available. This fixes the crash issues in gomuks, described in this bug: tulir/gomuks#250

This reverts commit aef08b1.
  • Loading branch information
jhe2 committed Apr 9, 2021
1 parent bb9a2b9 commit 5bb48e8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tscreen.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ const (
// $COLUMNS environment variables can be set to the actual window size,
// otherwise defaults taken from the terminal database are used.
func NewTerminfoScreen() (Screen, error) {
term := os.Getenv("TERM")
if len(term) >= 6 && term[:6] == "screen" && len(os.Getenv("TMUX")) > 0 {
term = "tmux"
}
ti, e := terminfo.LookupTerminfo(term)
ti, e := terminfo.LookupTerminfo(os.Getenv("TERM"))
if e != nil {
ti, e = loadDynamicTerminfo(term)
ti, e = loadDynamicTerminfo(os.Getenv("TERM"))
if e != nil {
return nil, e
}
Expand Down

0 comments on commit 5bb48e8

Please sign in to comment.