mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-21 09:38:46 +08:00
clang-format env.cpp and env_dispatch.cpp
This commit is contained in:
parent
1a4b1c3298
commit
3d98fd4308
|
@ -768,7 +768,7 @@ maybe_t<env_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key) cons
|
||||||
|
|
||||||
maybe_t<env_var_t> env_scoped_impl_t::try_get_local(const wcstring &key) const {
|
maybe_t<env_var_t> env_scoped_impl_t::try_get_local(const wcstring &key) const {
|
||||||
maybe_t<env_var_t> entry;
|
maybe_t<env_var_t> entry;
|
||||||
for (auto cur = locals_; cur; cur=cur->next) {
|
for (auto cur = locals_; cur; cur = cur->next) {
|
||||||
if ((entry = cur->find_entry(key))) break;
|
if ((entry = cur->find_entry(key))) break;
|
||||||
}
|
}
|
||||||
return entry; // this is either the entry or none() from find_entry
|
return entry; // this is either the entry or none() from find_entry
|
||||||
|
@ -784,7 +784,7 @@ maybe_t<env_var_t> env_scoped_impl_t::try_get_function(const wcstring &key) cons
|
||||||
// topmost local scope.
|
// topmost local scope.
|
||||||
if (node->new_scope) break;
|
if (node->new_scope) break;
|
||||||
}
|
}
|
||||||
for (auto cur = node; cur; cur=cur->next) {
|
for (auto cur = node; cur; cur = cur->next) {
|
||||||
if ((entry = cur->find_entry(key))) break;
|
if ((entry = cur->find_entry(key))) break;
|
||||||
}
|
}
|
||||||
return entry; // this is either the entry or none() from find_entry
|
return entry; // this is either the entry or none() from find_entry
|
||||||
|
|
|
@ -61,15 +61,10 @@
|
||||||
|
|
||||||
/// List of all locale environment variable names that might trigger (re)initializing the locale
|
/// List of all locale environment variable names that might trigger (re)initializing the locale
|
||||||
/// subsystem. These are only the variables we're possibly interested in.
|
/// subsystem. These are only the variables we're possibly interested in.
|
||||||
static const wcstring locale_variables[] = {L"LANG",
|
static const wcstring locale_variables[] = {
|
||||||
L"LANGUAGE",
|
L"LANG", L"LANGUAGE", L"LC_ALL",
|
||||||
L"LC_ALL",
|
L"LC_COLLATE", L"LC_CTYPE", L"LC_MESSAGES",
|
||||||
L"LC_COLLATE",
|
L"LC_NUMERIC", L"LC_TIME", L"fish_allow_singlebyte_locale",
|
||||||
L"LC_CTYPE",
|
|
||||||
L"LC_MESSAGES",
|
|
||||||
L"LC_NUMERIC",
|
|
||||||
L"LC_TIME",
|
|
||||||
L"fish_allow_singlebyte_locale",
|
|
||||||
L"LOCPATH"};
|
L"LOCPATH"};
|
||||||
|
|
||||||
/// List of all curses environment variable names that might trigger (re)initializing the curses
|
/// List of all curses environment variable names that might trigger (re)initializing the curses
|
||||||
|
@ -467,15 +462,21 @@ static bool initialize_curses_using_fallback(const char *term) {
|
||||||
// seeing if the fallback name can be used.
|
// seeing if the fallback name can be used.
|
||||||
auto &vars = env_stack_t::globals();
|
auto &vars = env_stack_t::globals();
|
||||||
auto term_var = vars.get(L"TERM");
|
auto term_var = vars.get(L"TERM");
|
||||||
if (term_var.missing_or_empty()) return false;
|
if (term_var.missing_or_empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto term_env = wcs2string(term_var->as_string());
|
auto term_env = wcs2string(term_var->as_string());
|
||||||
if (term_env == DEFAULT_TERM1 || term_env == DEFAULT_TERM2) return false;
|
if (term_env == DEFAULT_TERM1 || term_env == DEFAULT_TERM2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_interactive_session()) FLOGF(warning, _(L"Using fallback terminal type '%s'."), term);
|
if (is_interactive_session()) FLOGF(warning, _(L"Using fallback terminal type '%s'."), term);
|
||||||
|
|
||||||
int err_ret;
|
int err_ret;
|
||||||
if (setupterm(const_cast<char *>(term), STDOUT_FILENO, &err_ret) == OK) return true;
|
if (setupterm(const_cast<char *>(term), STDOUT_FILENO, &err_ret) == OK) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (is_interactive_session()) {
|
if (is_interactive_session()) {
|
||||||
FLOGF(warning, _(L"Could not set up terminal using the fallback terminal type '%s'."),
|
FLOGF(warning, _(L"Could not set up terminal using the fallback terminal type '%s'."),
|
||||||
term);
|
term);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user