2024-07-01 08:01:05 -07:00
|
|
|
package config
|
2022-12-03 08:25:09 -08:00
|
|
|
|
2024-07-02 03:02:57 -07:00
|
|
|
import "github.com/jandedobbeleer/oh-my-posh/src/runtime"
|
2022-12-03 08:25:09 -08:00
|
|
|
|
2024-07-02 03:02:57 -07:00
|
|
|
func shouldHideForWidth(env runtime.Environment, minWidth, maxWidth int) bool {
|
2022-12-03 08:25:09 -08:00
|
|
|
if maxWidth == 0 && minWidth == 0 {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
width, err := env.TerminalWidth()
|
|
|
|
if err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if minWidth > 0 && maxWidth > 0 {
|
|
|
|
return width < minWidth || width > maxWidth
|
|
|
|
}
|
|
|
|
if maxWidth > 0 && width > maxWidth {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if minWidth > 0 && width < minWidth {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|