Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.46k stars 949 forks source link

[Bugfix] fix #1013 TERM="xterm-256color" not recognized anymore on FreeBSD #1319

Closed thawk closed 5 years ago

thawk commented 5 years ago

Description

In FreeBSD (My version is FreeBSD 11.2), tput colors is the same as tput co, it returns the number of columns instead of the number of colors. tput Co returns the number of colors.

But in other OS, like my MacBook, tput Co failed to be executed. So some kind OS based logic has to be introduced to use difference terminfo capability at difference OS.

This PR use tput Co for and only for FreeBSD, use original tput colors otherwise.

romkatv commented 5 years ago

I've fixed this bug in Powerlevel10k in a portable way: https://github.com/romkatv/powerlevel10k/blob/b404c1b54e5c0e0ce978e4839c828171178ee824/internal/p10k.zsh#L2673. Feel free to backport the fix to Powerlevel9k.

(I usually open an issue against Powerlevel9k for every bug that I fix in Powerlevel10k but this time apparently I forgot to do so.)

thawk commented 5 years ago

@romkatv has a better, OS independent solution. Thx.