Skip to content

Commit

Permalink
Merge pull request #18 from komem3/shellwidth
Browse files Browse the repository at this point in the history
Supported for terminals that do not support 'TIOCGWINSZ'
  • Loading branch information
Yash-Handa committed Nov 1, 2020
2 parents c6c7cf7 + 023e18f commit 9972f56
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"os"
"strconv"
"time"

"github.com/Yash-Handa/logo-ls/internal/sysState"
Expand Down Expand Up @@ -220,6 +221,10 @@ func Bootstrap() {
// screen width for custom tw
w, _, e := terminal.GetSize(int(os.Stdout.Fd()))
if e == nil {
if w == 0 {
// for systems that don’t support ‘TIOCGWINSZ’.
w, _ = strconv.Atoi(os.Getenv("COLUMNS"))
}
sysState.TerminalWidth(w)
}
}
Expand Down

0 comments on commit 9972f56

Please sign in to comment.