mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Update code formatting
This commit is contained in:
parent
1ed8af2ee8
commit
e0e0bcdc1e
6 changed files with 153 additions and 138 deletions
|
@ -54,7 +54,8 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
struct builtin_printf_state_t {
|
struct builtin_printf_state_t
|
||||||
|
{
|
||||||
int exit_code;
|
int exit_code;
|
||||||
|
|
||||||
void verify_numeric(const wchar_t *s, const wchar_t *end);
|
void verify_numeric(const wchar_t *s, const wchar_t *end);
|
||||||
|
@ -376,16 +377,24 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
|
||||||
|
|
||||||
switch (conversion)
|
switch (conversion)
|
||||||
{
|
{
|
||||||
case L'd': case L'i':
|
case L'd':
|
||||||
|
case L'i':
|
||||||
length_modifier = L"lld";
|
length_modifier = L"lld";
|
||||||
length_modifier_len = sizeof L"lld" - 2;
|
length_modifier_len = sizeof L"lld" - 2;
|
||||||
break;
|
break;
|
||||||
case L'a': case L'e': case L'f': case L'g':
|
case L'a':
|
||||||
case L'A': case L'E': case L'F': case L'G':
|
case L'e':
|
||||||
|
case L'f':
|
||||||
|
case L'g':
|
||||||
|
case L'A':
|
||||||
|
case L'E':
|
||||||
|
case L'F':
|
||||||
|
case L'G':
|
||||||
length_modifier = L"L";
|
length_modifier = L"L";
|
||||||
length_modifier_len = 1;
|
length_modifier_len = 1;
|
||||||
break;
|
break;
|
||||||
case L's': case L'u':
|
case L's':
|
||||||
|
case L'u':
|
||||||
length_modifier = L"l";
|
length_modifier = L"l";
|
||||||
length_modifier_len = 1;
|
length_modifier_len = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -485,8 +494,10 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
|
||||||
case L's':
|
case L's':
|
||||||
if (!have_field_width)
|
if (!have_field_width)
|
||||||
{
|
{
|
||||||
if (!have_precision){
|
if (!have_precision)
|
||||||
append_format(stdout_buffer, fmt.c_str(), argument);}
|
{
|
||||||
|
append_format(stdout_buffer, fmt.c_str(), argument);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
append_format(stdout_buffer, fmt.c_str(), precision, argument);
|
append_format(stdout_buffer, fmt.c_str(), precision, argument);
|
||||||
}
|
}
|
||||||
|
@ -505,7 +516,8 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
|
||||||
arguments to any `%' directives.
|
arguments to any `%' directives.
|
||||||
Return the number of elements of ARGV used. */
|
Return the number of elements of ARGV used. */
|
||||||
|
|
||||||
int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wchar_t **argv) {
|
int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wchar_t **argv)
|
||||||
|
{
|
||||||
int save_argc = argc; /* Preserve original value. */
|
int save_argc = argc; /* Preserve original value. */
|
||||||
const wchar_t *f; /* Pointer into `format'. */
|
const wchar_t *f; /* Pointer into `format'. */
|
||||||
const wchar_t *direc_start; /* Start of % directive. */
|
const wchar_t *direc_start; /* Start of % directive. */
|
||||||
|
@ -557,7 +569,9 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
|
||||||
ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] =
|
ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] =
|
||||||
ok['o'] = ok['s'] = ok['x'] = ok['X'] = false;
|
ok['o'] = ok['s'] = ok['x'] = ok['X'] = false;
|
||||||
break;
|
break;
|
||||||
case '-': case '+': case ' ':
|
case '-':
|
||||||
|
case '+':
|
||||||
|
case ' ':
|
||||||
break;
|
break;
|
||||||
case L'#':
|
case L'#':
|
||||||
ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = false;
|
ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = false;
|
||||||
|
@ -569,7 +583,8 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
|
||||||
goto no_more_flag_characters;
|
goto no_more_flag_characters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
no_more_flag_characters:;
|
no_more_flag_characters:
|
||||||
|
;
|
||||||
|
|
||||||
if (*f == L'*')
|
if (*f == L'*')
|
||||||
{
|
{
|
||||||
|
@ -651,7 +666,7 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
|
||||||
if (! ok[conversion])
|
if (! ok[conversion])
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_("%.*ls: invalid conversion specification"),
|
_("%.*ls: invalid conversion specification"),
|
||||||
(int) (f + 1 - direc_start), direc_start);
|
(int)(f + 1 - direc_start), direc_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_direc(direc_start, direc_length, *f,
|
print_direc(direc_start, direc_length, *f,
|
||||||
|
|
|
@ -359,12 +359,12 @@ class completer_t
|
||||||
|
|
||||||
bool wants_descriptions() const
|
bool wants_descriptions() const
|
||||||
{
|
{
|
||||||
return !! (flags & COMPLETION_REQUEST_DESCRIPTIONS);
|
return !!(flags & COMPLETION_REQUEST_DESCRIPTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fuzzy() const
|
bool fuzzy() const
|
||||||
{
|
{
|
||||||
return !! (flags & COMPLETION_REQUEST_FUZZY_MATCH);
|
return !!(flags & COMPLETION_REQUEST_FUZZY_MATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1794,7 +1794,6 @@ void complete(const wcstring &cmd, std::vector<completion_t> &comps, completion_
|
||||||
/* Make our completer */
|
/* Make our completer */
|
||||||
completer_t completer(cmd, flags);
|
completer_t completer(cmd, flags);
|
||||||
|
|
||||||
const bool fuzzy = !! (flags & COMPLETION_REQUEST_FUZZY_MATCH);
|
|
||||||
const wchar_t *tok_begin, *tok_end, *cmdsubst_begin, *cmdsubst_end, *prev_begin, *prev_end;
|
const wchar_t *tok_begin, *tok_end, *cmdsubst_begin, *cmdsubst_end, *prev_begin, *prev_end;
|
||||||
wcstring current_token, prev_token;
|
wcstring current_token, prev_token;
|
||||||
wcstring current_command;
|
wcstring current_command;
|
||||||
|
|
|
@ -139,7 +139,8 @@ public:
|
||||||
bool operator != (const completion_t& rhs) const;
|
bool operator != (const completion_t& rhs) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
COMPLETION_REQUEST_DEFAULT = 0,
|
COMPLETION_REQUEST_DEFAULT = 0,
|
||||||
COMPLETION_REQUEST_AUTOSUGGESTION = 1 << 0, // indicates the completion is for an autosuggestion
|
COMPLETION_REQUEST_AUTOSUGGESTION = 1 << 0, // indicates the completion is for an autosuggestion
|
||||||
COMPLETION_REQUEST_DESCRIPTIONS = 1 << 1, // indicates that we want descriptions
|
COMPLETION_REQUEST_DESCRIPTIONS = 1 << 1, // indicates that we want descriptions
|
||||||
|
|
|
@ -1158,7 +1158,7 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c
|
||||||
for (size_t i=0; i< comp.size(); i++)
|
for (size_t i=0; i< comp.size(); i++)
|
||||||
{
|
{
|
||||||
const completion_t &el = comp.at(i);
|
const completion_t &el = comp.at(i);
|
||||||
if (! (el.flags & COMPLETE_CASE_INSENSITIVE))
|
if (!(el.flags & COMPLETE_CASE_INSENSITIVE))
|
||||||
{
|
{
|
||||||
has_case_sensitive = true;
|
has_case_sensitive = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue