mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -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)
|
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.CmdFlags.TerminalWidth = int(width)
|
||||||
env.DebugF("terminal width: %d", env.CmdFlags.TerminalWidth)
|
env.DebugF("terminal width: %d", env.CmdFlags.TerminalWidth)
|
||||||
return env.CmdFlags.TerminalWidth, err
|
return env.CmdFlags.TerminalWidth, err
|
||||||
|
|
Loading…
Reference in a new issue