Skip to content

Commit

Permalink
Fixed an issue with the terminal width detection that was contributed.
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Nov 3, 2017
1 parent a4bb002 commit f42ad60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions powerline.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ func (p *powerline) appendSegment(origin string, segment segment) {
}

func termWidth() int {
termWidth, _, err := terminal.GetSize(int(os.Stdout.Fd()))
termWidth, _, err := terminal.GetSize(int(os.Stdin.Fd()))
if err != nil {
shellMaxLengthStr, found := os.LookupEnv("COLUMNS")
if !found {
return 80 // Otherwise 0 default.
return 0
}

shellMaxLength64, err := strconv.ParseInt(shellMaxLengthStr, 0, 64)
if err != nil {
return 80 // Otherwise 0 default.
return 0
}

termWidth = int(shellMaxLength64)
Expand Down

0 comments on commit f42ad60

Please sign in to comment.