Update style and formatting to conform to fish style guide.

This commit is contained in:
ridiculousfish 2014-01-15 01:40:40 -08:00
parent e2fe873049
commit 53814983ff
28 changed files with 703 additions and 683 deletions

View file

@ -149,7 +149,11 @@ static void err(const wchar_t *blah, ...)
/* Test sane escapes */
static void test_unescape_sane()
{
const struct test_t {const wchar_t * input; const wchar_t * expected;} tests[] =
const struct test_t
{
const wchar_t * input;
const wchar_t * expected;
} tests[] =
{
{L"abcd", L"abcd"},
{L"'abcd'", L"abcd"},
@ -754,7 +758,8 @@ static void test_indents()
say(L"Testing indents");
// Here are the components of our source and the indents we expect those to be
struct indent_component_t {
struct indent_component_t
{
const wchar_t *txt;
int indent;
};
@ -2539,7 +2544,8 @@ static void test_highlighting(void)
if (system("touch /tmp/fish_highlight_test/bar")) err(L"touch failed");
// Here are the components of our source and the colors we expect those to be
struct highlight_component_t {
struct highlight_component_t
{
const wchar_t *txt;
int color;
};

View file

@ -128,7 +128,8 @@ enum parse_error_code_t
parse_error_double_background // foo && bar, has special error message
};
enum {
enum
{
PARSER_TEST_ERROR = 1,
PARSER_TEST_INCOMPLETE = 2
};

View file

@ -1215,7 +1215,8 @@ static screen_layout_t compute_layout(screen_t *s,
// If the command wraps, and the prompt is not short, place the command on its own line.
// A short prompt is 33% or less of the terminal's width.
const size_t prompt_percent_width = (100 * left_prompt_width) / screen_width;
if (left_prompt_width + first_command_line_width + 1 > screen_width && prompt_percent_width > 33) {
if (left_prompt_width + first_command_line_width + 1 > screen_width && prompt_percent_width > 33)
{
result.prompts_get_own_line = true;
}

View file

@ -458,10 +458,18 @@ static size_t read_redirection_or_fd_pipe(const wchar_t *buff, enum token_type *
/* We did not find a leading digit, so there's no explicit fd. Infer it from the type */
switch (buff[idx])
{
case L'>': fd = STDOUT_FILENO; break;
case L'<': fd = STDIN_FILENO; break;
case L'^': fd = STDERR_FILENO; break;
default: errored = true; break;
case L'>':
fd = STDOUT_FILENO;
break;
case L'<':
fd = STDIN_FILENO;
break;
case L'^':
fd = STDERR_FILENO;
break;
default:
errored = true;
break;
}
}
@ -556,10 +564,14 @@ int oflags_for_redirection_type(enum token_type type)
{
switch (type)
{
case TOK_REDIRECT_APPEND: return O_CREAT | O_APPEND | O_WRONLY;
case TOK_REDIRECT_OUT: return O_CREAT | O_WRONLY | O_TRUNC;
case TOK_REDIRECT_NOCLOB: return O_CREAT | O_EXCL | O_WRONLY;
case TOK_REDIRECT_IN: return O_RDONLY;
case TOK_REDIRECT_APPEND:
return O_CREAT | O_APPEND | O_WRONLY;
case TOK_REDIRECT_OUT:
return O_CREAT | O_WRONLY | O_TRUNC;
case TOK_REDIRECT_NOCLOB:
return O_CREAT | O_EXCL | O_WRONLY;
case TOK_REDIRECT_IN:
return O_RDONLY;
default:
return -1;