mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-27 03:49:40 -08:00
fix(unix): fetch COLUMNS when we don't have a terminal width
This commit is contained in:
parent
bb5e1b1a2e
commit
93d0cac0db
|
@ -66,6 +66,16 @@ func (env *Shell) TerminalWidth() (int, error) {
|
|||
env.Error(err)
|
||||
}
|
||||
|
||||
// fetch width from the environment variable
|
||||
// in case the terminal width is not available
|
||||
if width == 0 {
|
||||
i, err := strconv.Atoi(env.Getenv("COLUMNS"))
|
||||
if err != nil {
|
||||
env.Error(err)
|
||||
}
|
||||
width = uint(i)
|
||||
}
|
||||
|
||||
env.CmdFlags.TerminalWidth = int(width)
|
||||
env.DebugF("terminal width: %d", env.CmdFlags.TerminalWidth)
|
||||
return env.CmdFlags.TerminalWidth, err
|
||||
|
|
Loading…
Reference in a new issue