clang-format env.cpp and env_dispatch.cpp

This commit is contained in:
ridiculousfish 2022-04-16 12:22:44 -07:00
parent 1a4b1c3298
commit 3d98fd4308
2 changed files with 18 additions and 17 deletions

View File

@ -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> entry;
for (auto cur = locals_; cur; cur=cur->next) {
for (auto cur = locals_; cur; cur = cur->next) {
if ((entry = cur->find_entry(key))) break;
}
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.
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;
}
return entry; // this is either the entry or none() from find_entry

View File

@ -61,15 +61,10 @@
/// 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.
static const wcstring locale_variables[] = {L"LANG",
L"LANGUAGE",
L"LC_ALL",
L"LC_COLLATE",
L"LC_CTYPE",
L"LC_MESSAGES",
L"LC_NUMERIC",
L"LC_TIME",
L"fish_allow_singlebyte_locale",
static const wcstring locale_variables[] = {
L"LANG", L"LANGUAGE", L"LC_ALL",
L"LC_COLLATE", L"LC_CTYPE", L"LC_MESSAGES",
L"LC_NUMERIC", L"LC_TIME", L"fish_allow_singlebyte_locale",
L"LOCPATH"};
/// 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.
auto &vars = env_stack_t::globals();
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());
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);
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()) {
FLOGF(warning, _(L"Could not set up terminal using the fallback terminal type '%s'."),
term);