mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
lint: remove another "too few branches in switch statement"
This commit is contained in:
parent
a90b521eb4
commit
cdb82e45ac
1 changed files with 17 additions and 24 deletions
|
@ -2808,31 +2808,24 @@ const wchar_t *reader_readline(int nchars) {
|
|||
}
|
||||
}
|
||||
|
||||
switch (command_test_result) {
|
||||
case 0: {
|
||||
// Finished command, execute it. Don't add items that start with a leading
|
||||
// space.
|
||||
const editable_line_t *el = &data->command_line;
|
||||
if (data->history != NULL && !el->empty() && el->text.at(0) != L' ') {
|
||||
data->history->add_pending_with_file_detection(el->text);
|
||||
}
|
||||
finished = 1;
|
||||
update_buff_pos(&data->command_line, data->command_line.size());
|
||||
reader_repaint();
|
||||
break;
|
||||
}
|
||||
case PARSER_TEST_INCOMPLETE: {
|
||||
// We are incomplete, continue editing.
|
||||
insert_char(el, '\n');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Result must be some combination including an error. The error message
|
||||
// will already be printed, all we need to do is repaint.
|
||||
s_reset(&data->screen, screen_reset_abandon_line);
|
||||
reader_repaint_needed();
|
||||
break;
|
||||
if (command_test_result == 0) {
|
||||
// Finished command, execute it. Don't add items that start with a leading
|
||||
// space.
|
||||
const editable_line_t *el = &data->command_line;
|
||||
if (data->history != NULL && !el->empty() && el->text.at(0) != L' ') {
|
||||
data->history->add_pending_with_file_detection(el->text);
|
||||
}
|
||||
finished = 1;
|
||||
update_buff_pos(&data->command_line, data->command_line.size());
|
||||
reader_repaint();
|
||||
} else if (command_test_result == PARSER_TEST_INCOMPLETE) {
|
||||
// We are incomplete, continue editing.
|
||||
insert_char(el, '\n');
|
||||
} else {
|
||||
// Result must be some combination including an error. The error message will
|
||||
// already be printed, all we need to do is repaint.
|
||||
s_reset(&data->screen, screen_reset_abandon_line);
|
||||
reader_repaint_needed();
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue