time for another make style-all

Gotta keep the entropy (i.e., disorder) from increasing.
This commit is contained in:
Kurtis Rader 2017-01-26 20:00:43 -08:00
parent 05d569ee44
commit 5b6cc5af6d
29 changed files with 200 additions and 213 deletions

View file

@ -160,8 +160,11 @@ if set -q MANPATH
end
set __fish_tmp_manpath $__fish_tmp_manpath[-1..1]
end
test -r /etc/manpaths ; and __fish_load_manpath_helper_manpaths < /etc/manpaths
for manpathfile in /etc/manpaths.d/* ; __fish_load_manpath_helper_manpaths < $manpathfile ; end
test -r /etc/manpaths
and __fish_load_manpath_helper_manpaths </etc/manpaths
for manpathfile in /etc/manpaths.d/*
__fish_load_manpath_helper_manpaths <$manpathfile
end
set -xg MANPATH $__fish_tmp_manpath
set -e __fish_tmp_manpath
functions -e __fish_load_manpath_helper_manpaths

View file

@ -143,7 +143,8 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
fgcolors.push_back(fg);
}
if (fgcolors.empty() && bgcolor == NULL && !bold && !underline && !italics && !dim && !reverse) {
if (fgcolors.empty() && bgcolor == NULL && !bold && !underline && !italics && !dim &&
!reverse) {
streams.err.append_format(_(L"%ls: Expected an argument\n"), argv[0]);
return STATUS_BUILTIN_ERROR;
}

View file

@ -170,8 +170,7 @@ class test_parser {
unique_ptr<expression> parse_binary_primary(unsigned int start, unsigned int end);
unique_ptr<expression> parse_just_a_string(unsigned int start, unsigned int end);
static unique_ptr<expression> parse_args(const wcstring_list_t &args,
wcstring &err,
static unique_ptr<expression> parse_args(const wcstring_list_t &args, wcstring &err,
wchar_t *program_name);
};
@ -280,7 +279,8 @@ unique_ptr<expression> test_parser::parse_unary_expression(unsigned int start, u
if (tok == test_bang) {
unique_ptr<expression> subject(parse_unary_expression(start + 1, end));
if (subject.get()) {
return make_unique<unary_operator>(tok, range_t(start, subject->range.end), move(subject));
return make_unique<unary_operator>(tok, range_t(start, subject->range.end),
move(subject));
}
return NULL;
}
@ -288,7 +288,8 @@ unique_ptr<expression> test_parser::parse_unary_expression(unsigned int start, u
}
/// Parse a combining expression (AND, OR).
unique_ptr<expression> test_parser::parse_combining_expression(unsigned int start, unsigned int end) {
unique_ptr<expression> test_parser::parse_combining_expression(unsigned int start,
unsigned int end) {
if (start >= end) return NULL;
std::vector<unique_ptr<expression>> subjects;
@ -333,7 +334,8 @@ unique_ptr<expression> test_parser::parse_combining_expression(unsigned int star
}
// Our new expression takes ownership of all expressions we created. The token we pass is
// irrelevant.
return make_unique<combining_expression>(test_combine_and, range_t(start, idx), move(subjects), move(combiners));
return make_unique<combining_expression>(test_combine_and, range_t(start, idx), move(subjects),
move(combiners));
}
unique_ptr<expression> test_parser::parse_unary_primary(unsigned int start, unsigned int end) {
@ -383,7 +385,8 @@ unique_ptr<expression> test_parser::parse_binary_primary(unsigned int start, uns
const token_info_t *info = token_for_string(arg(start + 1));
if (!(info->flags & BINARY_PRIMARY)) return NULL;
return make_unique<binary_primary>(info->tok, range_t(start, start + 3), arg(start), arg(start + 2));
return make_unique<binary_primary>(info->tok, range_t(start, start + 3), arg(start),
arg(start + 2));
}
unique_ptr<expression> test_parser::parse_parenthentical(unsigned int start, unsigned int end) {
@ -410,7 +413,8 @@ unique_ptr<expression> test_parser::parse_parenthentical(unsigned int start, uns
}
// Success.
return make_unique<parenthetical_expression>(test_paren_open, range_t(start, close_index + 1), move(subexpr));
return make_unique<parenthetical_expression>(test_paren_open, range_t(start, close_index + 1),
move(subexpr));
}
unique_ptr<expression> test_parser::parse_primary(unsigned int start, unsigned int end) {
@ -444,8 +448,7 @@ unique_ptr<expression> test_parser::parse_3_arg_expression(unsigned int start, u
subjects.push_back(move(left));
subjects.push_back(move(right));
result = make_unique<combining_expression>(center_token->tok, range_t(start, end),
move(subjects),
move(combiners));
move(subjects), move(combiners));
}
} else {
result = parse_unary_expression(start, end);
@ -461,7 +464,8 @@ unique_ptr<expression> test_parser::parse_4_arg_expression(unsigned int start, u
if (first_token == test_bang) {
unique_ptr<expression> subject(parse_3_arg_expression(start + 1, end));
if (subject.get()) {
result = make_unique<unary_operator>(first_token, range_t(start, subject->range.end), move(subject));
result = make_unique<unary_operator>(first_token, range_t(start, subject->range.end),
move(subject));
}
} else if (first_token == test_paren_open) {
result = parse_parenthentical(start, end);

View file

@ -19,7 +19,13 @@ class rgb_color_t {
unsigned char type : 4;
// Flags
enum { flag_bold = 1 << 0, flag_underline = 1 << 1, flag_italics = 1 << 2, flag_dim = 1 << 3, flag_reverse = 1 << 4 };
enum {
flag_bold = 1 << 0,
flag_underline = 1 << 1,
flag_italics = 1 << 2,
flag_dim = 1 << 3,
flag_reverse = 1 << 4
};
unsigned char flags : 5;
union {

View file

@ -683,7 +683,6 @@ ssize_t write_loop(int fd, const char *buff, size_t count);
/// error.
ssize_t read_loop(int fd, void *buff, size_t count);
/// Replace special characters with backslash escape sequences. Newline is replaced with \n, etc.
///
/// \param in The string to be escaped

View file

@ -673,8 +673,7 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool
// updated with choices for the user.
expand_error_t ignore =
expand_string(str_cmd, &this->completions,
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(),
NULL);
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL);
USE(ignore);
}
@ -864,9 +863,7 @@ bool completer_t::complete_param(const wcstring &scmd_orig, const wcstring &spop
} else if (this->type() == COMPLETE_AUTOSUGGEST &&
!completion_autoloader.has_tried_loading(cmd)) {
// Load this command (on the main thread)
iothread_perform_on_main([&](){
complete_load(cmd, false);
});
iothread_perform_on_main([&]() { complete_load(cmd, false); });
}
// Make a list of lists of all options that we care about.
@ -1454,7 +1451,8 @@ void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *out_c
wcstring faux_cmdline = cmd;
faux_cmdline.replace(cmd_node->source_start,
cmd_node->source_length, wrap_chain.at(i));
transient_cmd = make_unique<builtin_commandline_scoped_transient_t>(faux_cmdline);
transient_cmd = make_unique<builtin_commandline_scoped_transient_t>(
faux_cmdline);
}
if (!completer.complete_param(wrap_chain.at(i),
previous_argument_unescape,

View file

@ -77,7 +77,6 @@ class env_node_t {
env_node_t(bool is_new_scope) : new_scope(is_new_scope) {}
public:
/// Variable table.
var_table_t env;
/// Does this node imply a new variable scope? If yes, all non-global variables below this one
@ -122,9 +121,7 @@ struct var_stack_t {
void mark_changed_exported() { has_changed_exported = true; }
void update_export_array_if_necessary();
var_stack_t() : top(new env_node_t(false)) {
this->global_env = this->top.get();
}
var_stack_t() : top(new env_node_t(false)) { this->global_env = this->top.get(); }
// Pushes a new node onto our stack
// Optionally creates a new scope for the node
@ -177,9 +174,9 @@ void var_stack_t::pop() {
}
}
// Actually do the pop!
// Move the top pointer into a local variable, then replace the top pointer with the next pointer
// afterwards we should have a node with no next pointer, and our top should be non-null
// Actually do the pop! Move the top pointer into a local variable, then replace the top pointer
// with the next pointer afterwards we should have a node with no next pointer, and our top
// should be non-null.
std::unique_ptr<env_node_t> old_top = std::move(this->top);
this->top = std::move(old_top->next);
old_top->next.reset();
@ -194,7 +191,7 @@ void var_stack_t::pop() {
break;
}
}
// TODO: move this to something general
// TODO: Move this to something general.
if (locale_changed) handle_locale(locale_changed);
}
@ -348,9 +345,7 @@ static bool var_is_curses(const wcstring &key) {
static bool can_set_term_title = false;
/// Returns true if we think the terminal supports setting its title.
bool term_supports_setting_title() {
return can_set_term_title;
}
bool term_supports_setting_title() { return can_set_term_title; }
/// This is a pretty lame heuristic for detecting terminals that do not support setting the
/// title. If we recognise the terminal name as that of a virtual terminal, we assume it supports
@ -381,9 +376,7 @@ static bool does_term_support_setting_title() {
}
/// Handle changes to the TERM env var that do not involves the curses subsystem.
static void handle_term() {
can_set_term_title = does_term_support_setting_title();
}
static void handle_term() { can_set_term_title = does_term_support_setting_title(); }
/// Push all curses/terminfo env vars into the global environment where they can be found by those
/// libraries.
@ -1039,13 +1032,9 @@ static bool local_scope_exports(const env_node_t *n) {
return local_scope_exports(n->next.get());
}
void env_push(bool new_scope) {
vars_stack().push(new_scope);
}
void env_push(bool new_scope) { vars_stack().push(new_scope); }
void env_pop() {
vars_stack().pop();
}
void env_pop() { vars_stack().pop(); }
/// Function used with to insert keys of one table into a set::set<wcstring>.
static void add_key_to_string_set(const var_table_t &envs, std::set<wcstring> *str_set,

View file

@ -864,8 +864,8 @@ void env_universal_t::parse_message_internal(const wcstring &msgstr, var_table_t
#ifdef SIOCGIFHWADDR
// Linux
#include <sys/socket.h>
#include <net/if.h>
#include <sys/socket.h>
static bool get_mac_address(unsigned char macaddr[MAC_ADDRESS_MAX_LEN],
const char *interface = "eth0") {
bool result = false;
@ -886,9 +886,9 @@ static bool get_mac_address(unsigned char macaddr[MAC_ADDRESS_MAX_LEN],
#elif defined(HAVE_GETIFADDRS)
// OS X and BSD
#include <sys/socket.h>
#include <ifaddrs.h>
#include <net/if_dl.h>
#include <sys/socket.h>
static bool get_mac_address(unsigned char macaddr[MAC_ADDRESS_MAX_LEN],
const char *interface = "en0") {
// BSD, Mac OS X

View file

@ -136,8 +136,8 @@ class universal_notifier_t {
virtual ~universal_notifier_t();
// Factory constructor.
static std::unique_ptr<universal_notifier_t> new_notifier_for_strategy(notifier_strategy_t strat,
const wchar_t *test_path = NULL);
static std::unique_ptr<universal_notifier_t> new_notifier_for_strategy(
notifier_strategy_t strat, const wchar_t *test_path = NULL);
// Default instance. Other instances are possible for testing.
static universal_notifier_t &default_notifier();

View file

@ -333,9 +333,8 @@ static void event_fire_internal(const event_t &event) {
// Iterate over our list of matching events.
for (shared_ptr<event_t> &criterion : fire) {
// Only fire if this event is still present
if (std::find(s_event_handlers.begin(),
s_event_handlers.end(),
criterion) == s_event_handlers.end()) {
if (std::find(s_event_handlers.begin(), s_event_handlers.end(), criterion) ==
s_event_handlers.end()) {
continue;
}
@ -445,9 +444,7 @@ void event_fire(const event_t *event) {
void event_init() {}
void event_destroy() {
s_event_handlers.clear();
}
void event_destroy() { s_event_handlers.clear(); }
void event_fire_generic(const wchar_t *name, wcstring_list_t *args) {
CHECK(name, );

View file

@ -637,7 +637,8 @@ void exec_job(parser_t &parser, job_t *j) {
break;
}
function_block_t *fb = parser.push_block<function_block_t>(p, func_name, shadow_scope);
function_block_t *fb =
parser.push_block<function_block_t>(p, func_name, shadow_scope);
// Setting variables might trigger an event handler, hence we need to unblock
// signals.

View file

@ -430,9 +430,10 @@ bool process_iterator_t::next_process(wcstring *out_str, pid_t *out_pid) {
#endif
/// The following function is invoked on the main thread, because the job list is not thread safe.
/// It should search the job list for something matching the given proc, and then return true to stop
/// the search, false to continue it.
static bool find_job(const wchar_t *proc, expand_flags_t flags, std::vector<completion_t> *completions) {
/// It should search the job list for something matching the given proc, and then return true to
/// stop the search, false to continue it.
static bool find_job(const wchar_t *proc, expand_flags_t flags,
std::vector<completion_t> *completions) {
ASSERT_IS_MAIN_THREAD();
bool found = false;
@ -540,9 +541,7 @@ static void find_process(const wchar_t *proc, expand_flags_t flags,
std::vector<completion_t> *out) {
if (!(flags & EXPAND_SKIP_JOBS)) {
bool found = false;
iothread_perform_on_main([&](){
found = find_job(proc, flags, out);
});
iothread_perform_on_main([&]() { found = find_job(proc, flags, out); });
if (found) {
return;
}

View file

@ -2898,7 +2898,8 @@ void history_tests_t::test_history_merge(void) {
say(L"Testing history merge");
const size_t count = 3;
const wcstring name = L"merge_test";
std::unique_ptr<history_t> hists[count] = {make_unique<history_t>(name), make_unique<history_t>(name), make_unique<history_t>(name)};
std::unique_ptr<history_t> hists[count] = {
make_unique<history_t>(name), make_unique<history_t>(name), make_unique<history_t>(name)};
const wcstring texts[count] = {L"History 1", L"History 2", L"History 3"};
const wcstring alt_texts[count] = {L"History Alt 1", L"History Alt 2", L"History Alt 3"};
@ -4056,16 +4057,11 @@ static void test_illegal_command_exit_code(void) {
};
const command_result_tuple_t tests[] = {
{L"echo -n", STATUS_BUILTIN_OK},
{L"pwd", STATUS_BUILTIN_OK},
{L")", STATUS_ILLEGAL_CMD},
{L") ", STATUS_ILLEGAL_CMD},
{L"*", STATUS_ILLEGAL_CMD},
{L"**", STATUS_ILLEGAL_CMD},
{L"%", STATUS_ILLEGAL_CMD},
{L"%test", STATUS_ILLEGAL_CMD},
{L"?", STATUS_ILLEGAL_CMD},
{L"abc?def", STATUS_ILLEGAL_CMD},
{L"echo -n", STATUS_BUILTIN_OK}, {L"pwd", STATUS_BUILTIN_OK},
{L")", STATUS_ILLEGAL_CMD}, {L") ", STATUS_ILLEGAL_CMD},
{L"*", STATUS_ILLEGAL_CMD}, {L"**", STATUS_ILLEGAL_CMD},
{L"%", STATUS_ILLEGAL_CMD}, {L"%test", STATUS_ILLEGAL_CMD},
{L"?", STATUS_ILLEGAL_CMD}, {L"abc?def", STATUS_ILLEGAL_CMD},
{L") ", STATUS_ILLEGAL_CMD}};
int res = 0;

View file

@ -1742,9 +1742,8 @@ void history_t::add_pending_with_file_detection(const wcstring &str) {
// Check for which paths are valid on a background thread,
// then on the main thread update our history item
const wcstring wd = env_get_pwd_slash();
iothread_perform([=](){
return valid_paths(potential_paths, wd);
}, [=](path_list_t validated_paths){
iothread_perform([=]() { return valid_paths(potential_paths, wd); },
[=](path_list_t validated_paths) {
this->set_valid_file_paths(validated_paths, identifier);
this->enable_automatic_saving();
});

View file

@ -2,8 +2,8 @@
#ifndef INPUT_COMMON_H
#define INPUT_COMMON_H
#include <functional>
#include <stddef.h>
#include <functional>
#include "common.h"

View file

@ -39,13 +39,10 @@ struct spawn_request_t {
void_function_t handler;
void_function_t completion;
spawn_request_t()
{}
spawn_request_t() {}
spawn_request_t(void_function_t f, void_function_t comp) :
handler(std::move(f)),
completion(std::move(comp))
{}
spawn_request_t(void_function_t f, void_function_t comp)
: handler(std::move(f)), completion(std::move(comp)) {}
// Move-only
spawn_request_t &operator=(const spawn_request_t &) = delete;
@ -77,9 +74,11 @@ static pthread_mutex_t s_result_queue_lock = PTHREAD_MUTEX_INITIALIZER;
static std::queue<spawn_request_t> s_result_queue;
// "Do on main thread" support.
static pthread_mutex_t s_main_thread_performer_lock = PTHREAD_MUTEX_INITIALIZER; // protects the main thread requests
static pthread_mutex_t s_main_thread_performer_lock =
PTHREAD_MUTEX_INITIALIZER; // protects the main thread requests
static pthread_cond_t s_main_thread_performer_cond; // protects the main thread requests
static pthread_mutex_t s_main_thread_request_q_lock = PTHREAD_MUTEX_INITIALIZER; // protects the queue
static pthread_mutex_t s_main_thread_request_q_lock =
PTHREAD_MUTEX_INITIALIZER; // protects the queue
static std::queue<main_thread_request_t *> s_main_thread_request_queue;
// Notifying pipes.

View file

@ -27,8 +27,7 @@ void iothread_service_completion(void);
void iothread_drain_all(void);
// Internal implementation
int iothread_perform_impl(std::function<void(void)> &&func,
std::function<void(void)> &&completion);
int iothread_perform_impl(std::function<void(void)> &&func, std::function<void(void)> &&completion);
// Template helpers
// This is the glue part of the handler-completion handoff
@ -42,11 +41,13 @@ struct _iothread_trampoline {
static int perform(const HANDLER &handler, const COMPLETION &completion) {
T *result = new T(); // TODO: placement new?
return iothread_perform_impl([=]() { *result = handler(); },
[=](){ completion(std::move(*result)); delete result; });
[=]() {
completion(std::move(*result));
delete result;
});
}
};
// Void specialization
template <>
struct _iothread_trampoline<void> {
@ -67,8 +68,7 @@ int iothread_perform(const HANDLER &handler, const COMPLETION &completion) {
// variant of iothread_perform without a completion handler
inline int iothread_perform(std::function<void(void)> &&func) {
return iothread_perform_impl(std::move(func),
std::function<void(void)>());
return iothread_perform_impl(std::move(func), std::function<void(void)>());
}
/// Performs a function on the main thread, blocking until it completes.

View file

@ -75,9 +75,8 @@ static wcstring profiling_cmd_name_for_redirectable_block(const parse_node_t &no
return result;
}
parse_execution_context_t::parse_execution_context_t(parse_node_tree_t t,
const wcstring &s, parser_t *p,
int initial_eval_level)
parse_execution_context_t::parse_execution_context_t(parse_node_tree_t t, const wcstring &s,
parser_t *p, int initial_eval_level)
: tree(std::move(t)),
src(s),
parser(p),
@ -1271,7 +1270,8 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
job->set_flag(JOB_TERMINAL, job->get_flag(JOB_CONTROL) && !is_subshell && !is_event);
job->set_flag(JOB_SKIP_NOTIFICATION, is_subshell || is_block || is_event || !shell_is_interactive());
job->set_flag(JOB_SKIP_NOTIFICATION,
is_subshell || is_block || is_event || !shell_is_interactive());
// Tell the current block what its job is. This has to happen before we populate it (#1394).
parser->current_block()->job = job;

View file

@ -124,7 +124,6 @@ const wchar_t *token_type_description(parse_token_type_t type) {
const wchar_t *description = enum_to_str(type, token_enum_map);
if (description) return description;
return L"unknown_token_type";
}
const wchar_t *keyword_description(parse_keyword_t type) {

View file

@ -596,7 +596,8 @@ int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t
return this->eval(cmd, io, block_type, std::move(tree));
}
int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type, parse_node_tree_t tree) {
int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type,
parse_node_tree_t tree) {
CHECK_BLOCK(1);
assert(block_type == TOP || block_type == SUBST);
@ -612,8 +613,8 @@ int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t
(execution_contexts.empty() ? -1 : execution_contexts.back()->current_eval_level());
// Append to the execution context stack.
execution_contexts.push_back(make_unique<parse_execution_context_t>(std::move(tree), cmd,
this, exec_eval_level));
execution_contexts.push_back(
make_unique<parse_execution_context_t>(std::move(tree), cmd, this, exec_eval_level));
const parse_execution_context_t *ctx = execution_contexts.back().get();
// Execute the first node.

View file

@ -244,7 +244,8 @@ class parser_t {
int eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type);
/// Evaluate the expressions contained in cmd, which has been parsed into the given parse tree.
int eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type, parse_node_tree_t t);
int eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type,
parse_node_tree_t t);
/// Evaluates a block node at the given node offset in the topmost execution context.
int eval_block_node(node_offset_t node_idx, const io_chain_t &io, enum block_type_t block_type);

View file

@ -239,9 +239,7 @@ void job_t::set_flag(job_flag_t flag, bool set) {
}
}
bool job_t::get_flag(job_flag_t flag) const {
return !! (this->flags & flag);
}
bool job_t::get_flag(job_flag_t flag) const { return !!(this->flags & flag); }
int job_signal(job_t *j, int signal) {
pid_t my_pid = getpid();
@ -368,9 +366,7 @@ process_t::process_t()
job_t::job_t(job_id_t jobid, const io_chain_t &bio)
: block_io(bio), pgid(0), tmodes(), job_id(jobid), flags(0) {}
job_t::~job_t() {
release_job_id(job_id);
}
job_t::~job_t() { release_job_id(job_id); }
/// Return all the IO redirections. Start with the block IO, then walk over the processes.
io_chain_t job_t::all_io_redirections() const {
@ -805,7 +801,8 @@ static bool terminal_give_to_job(job_t *j, int cont) {
}
if (result == -1) {
if (errno == ENOTTY) redirect_tty_output();
debug(1, _(L"terminal_give_to_job(): Could not send job %d ('%ls') to foreground"), j->job_id, j->command_wcstr());
debug(1, _(L"terminal_give_to_job(): Could not send job %d ('%ls') to foreground"),
j->job_id, j->command_wcstr());
wperror(L"tcsetattr");
return false;
}
@ -985,7 +982,6 @@ void proc_sanity_check() {
while (const job_t *j = jobs.next()) {
if (!j->get_flag(JOB_CONSTRUCTED)) continue;
// More than one foreground job?
if (j->get_flag(JOB_FOREGROUND) && !(job_is_stopped(j) || job_is_completed(j))) {
if (fg_job) {
@ -1013,7 +1009,6 @@ void proc_sanity_check() {
j->command_wcstr(), p->argv0(), p->completed);
sanity_lose();
}
}
}
}

View file

@ -37,8 +37,8 @@
#include <wctype.h>
#include <algorithm>
#include <stack>
#include <memory>
#include <stack>
#include "color.h"
#include "common.h"
@ -1118,8 +1118,8 @@ struct autosuggestion_result_t {
// Returns a function that can be invoked (potentially
// on a background thread) to determine the autosuggestion
static std::function<autosuggestion_result_t(void)>
get_autosuggestion_performer(const wcstring &search_string, size_t cursor_pos, history_t *history) {
static std::function<autosuggestion_result_t(void)> get_autosuggestion_performer(
const wcstring &search_string, size_t cursor_pos, history_t *history) {
const unsigned int generation_count = s_generation_count;
const wcstring working_directory(env_get_pwd_slash());
env_vars_snapshot_t vars(env_vars_snapshot_t::highlighting_keys);
@ -1135,8 +1135,8 @@ get_autosuggestion_performer(const wcstring &search_string, size_t cursor_pos, h
return nothing;
}
VOMIT_ON_FAILURE(pthread_setspecific(generation_count_key,
(void *)(uintptr_t)generation_count));
VOMIT_ON_FAILURE(
pthread_setspecific(generation_count_key, (void *)(uintptr_t)generation_count));
// Let's make sure we aren't using the empty string.
if (search_string.empty()) {
@ -1176,9 +1176,8 @@ get_autosuggestion_performer(const wcstring &search_string, size_t cursor_pos, h
if (!completions.empty()) {
const completion_t &comp = completions.at(0);
size_t cursor = cursor_pos;
wcstring suggestion = completion_apply_to_command_line(comp.completion, comp.flags,
search_string, &cursor,
true /* append only */);
wcstring suggestion = completion_apply_to_command_line(
comp.completion, comp.flags, search_string, &cursor, true /* append only */);
return {std::move(suggestion), search_string};
}
@ -1197,8 +1196,7 @@ static bool can_autosuggest(void) {
// Called after an autosuggestion has been computed on a background thread
static void autosuggest_completed(autosuggestion_result_t result) {
if (! result.suggestion.empty() &&
can_autosuggest() &&
if (!result.suggestion.empty() && can_autosuggest() &&
result.search_string == data->command_line.text &&
string_prefixes_string_case_insensitive(result.search_string, result.suggestion)) {
// Autosuggestion is active and the search term has not changed, so we're good to go.
@ -2104,7 +2102,8 @@ static void highlight_complete(highlight_result_t result) {
// Given text, bracket matching position, and whether IO is allowed,
// return a function that performs highlighting. The function may be invoked on a background thread.
static std::function<highlight_result_t(void)> get_highlight_performer(const wcstring &text,
long match_highlight_pos, bool no_io) {
long match_highlight_pos,
bool no_io) {
env_vars_snapshot_t vars(env_vars_snapshot_t::highlighting_keys);
unsigned int generation_count = s_generation_count;
highlight_function_t highlight_func = no_io ? highlight_shell_no_io : data->highlight_function;
@ -2116,7 +2115,8 @@ static std::function<highlight_result_t(void)> get_highlight_performer(const wcs
if (text.empty()) {
return {};
}
VOMIT_ON_FAILURE(pthread_setspecific(generation_count_key, (void *)(uintptr_t)generation_count));
VOMIT_ON_FAILURE(
pthread_setspecific(generation_count_key, (void *)(uintptr_t)generation_count));
std::vector<highlight_spec_t> colors(text.size(), 0);
highlight_func(text, colors, match_highlight_pos, NULL /* error */, vars);
return {std::move(colors), text};