mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Gracefully handle echotc Co
failure
In Emacs, `M-x shell` creates a shell buffer with very rudimentary terminal capabilities. `$TERM` is set to `dumb`, and `echotc Co` fails after printing `echotc: no such capability: Co` to standard error. If our goal was to determine whether the terminal supports 256 colors, we really have no information to go on. I recommend that we trust the user and hope for the best. That means we should (1) discard any `echotc Co` error output, and (2) forego the warning message about having fewer than 256 colors if `echotc Co` failed.
This commit is contained in:
parent
fa21d8fbc9
commit
9444e4c0c6
1 changed files with 2 additions and 2 deletions
|
@ -1317,8 +1317,8 @@ prompt_powerlevel9k_setup() {
|
||||||
|
|
||||||
# Display a warning if the terminal does not support 256 colors
|
# Display a warning if the terminal does not support 256 colors
|
||||||
local term_colors
|
local term_colors
|
||||||
term_colors=$(echotc Co)
|
term_colors=$(echotc Co 2>/dev/null)
|
||||||
if (( $term_colors < 256 )); then
|
if (( ! $? && ${term_colors:-0} < 256 )); then
|
||||||
print -P "%F{red}WARNING!%f Your terminal appears to support less than 256 colors!"
|
print -P "%F{red}WARNING!%f Your terminal appears to support less than 256 colors!"
|
||||||
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
|
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
|
||||||
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
|
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
|
||||||
|
|
Loading…
Reference in a new issue