mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Remove some ancient "#if 0' code and fix formatting errors
This commit is contained in:
parent
85fba3a316
commit
9ba6b62791
2 changed files with 5 additions and 91 deletions
|
@ -2734,14 +2734,14 @@ const wchar_t *reader_readline(int nchars) {
|
|||
bool continue_on_next_line = false;
|
||||
if (el->position >= el->size()) {
|
||||
// We're at the end of the text and not in a comment (issue #1225).
|
||||
continue_on_next_line = is_backslashed(el->text, el->position) &&
|
||||
!text_ends_in_comment(el->text);
|
||||
continue_on_next_line =
|
||||
is_backslashed(el->text, el->position) && !text_ends_in_comment(el->text);
|
||||
} else {
|
||||
// Allow mid line split if the following character is whitespace (issue #613).
|
||||
if (is_backslashed(el->text, el->position) &&
|
||||
iswspace(el->text.at(el->position))) {
|
||||
continue_on_next_line = true;
|
||||
// Check if the end of the line is backslashed (issue #4467).
|
||||
// Check if the end of the line is backslashed (issue #4467).
|
||||
} else if (is_backslashed(el->text, el->size()) &&
|
||||
!text_ends_in_comment(el->text)) {
|
||||
// Move the cursor to the end of the line.
|
||||
|
@ -2974,7 +2974,8 @@ const wchar_t *reader_readline(int nchars) {
|
|||
select_completion_in_direction(direction);
|
||||
} else if (!data->pager.empty()) {
|
||||
// We pressed a direction with a non-empty pager, begin navigation.
|
||||
select_completion_in_direction(c == R_DOWN_LINE ? direction_south : direction_north);
|
||||
select_completion_in_direction(c == R_DOWN_LINE ? direction_south
|
||||
: direction_north);
|
||||
} else {
|
||||
// Not navigating the pager contents.
|
||||
editable_line_t *el = data->active_edit_line();
|
||||
|
@ -3188,7 +3189,6 @@ const wchar_t *reader_readline(int nchars) {
|
|||
// Other, if a normal character, we add it to the command.
|
||||
if (!fish_reserved_codepoint(c) && (c >= L' ' || c == L'\n' || c == L'\r') &&
|
||||
c != 0x7F) {
|
||||
|
||||
// Regular character.
|
||||
editable_line_t *el = data->active_edit_line();
|
||||
bool allow_expand_abbreviations = (el == &data->command_line);
|
||||
|
|
|
@ -360,23 +360,6 @@ static size_t calc_prompt_lines(const wcstring &prompt) {
|
|||
/// Stat stdout and stderr and save result. This should be done before calling a function that may
|
||||
/// cause output.
|
||||
static void s_save_status(screen_t *s) {
|
||||
// PCA Let's not do this futimes stuff, because sudo dumbly uses the tty's ctime as part of its
|
||||
// tty_tickets feature. Disabling this should fix issue #122.
|
||||
#if 0
|
||||
// This futimes call tries to trick the system into using st_mtime as a tampering flag. This of
|
||||
// course only works on systems where futimes is defined, but it should make the status saving
|
||||
// stuff failsafe.
|
||||
struct timeval t[] = {
|
||||
{ time(0)-1, 0 },
|
||||
{ time(0)-1, 0 }
|
||||
};
|
||||
|
||||
// Don't check return value on these. We don't care if they fail, really. This is all just to
|
||||
// make the prompt look ok, which is impossible to do 100% reliably. We try, at least.
|
||||
futimes(1, t);
|
||||
futimes(2, t);
|
||||
#endif
|
||||
|
||||
fstat(1, &s->prev_buff_1);
|
||||
fstat(2, &s->prev_buff_2);
|
||||
}
|
||||
|
@ -508,11 +491,6 @@ static void s_move(screen_t *s, data_buffer_t *b, int new_x, int new_y) {
|
|||
int x_steps, y_steps;
|
||||
|
||||
char *str;
|
||||
/*
|
||||
debug( 0, L"move from %d %d to %d %d",
|
||||
s->screen_cursor[0], s->screen_cursor[1],
|
||||
new_x, new_y );
|
||||
*/
|
||||
scoped_buffer_t scoped_buffer(b);
|
||||
|
||||
y_steps = new_y - s->actual.cursor.y;
|
||||
|
@ -645,64 +623,6 @@ static bool perform_any_impending_soft_wrap(screen_t *scr, int x, int y) {
|
|||
/// Make sure we don't soft wrap.
|
||||
static void invalidate_soft_wrap(screen_t *scr) { scr->soft_wrap_location = INVALID_LOCATION; }
|
||||
|
||||
#if 0
|
||||
/// Various code for testing term behavior.
|
||||
static bool test_stuff(screen_t *scr)
|
||||
{
|
||||
data_buffer_t output;
|
||||
scoped_buffer_t scoped_buffer(&output);
|
||||
|
||||
s_move(scr, &output, 0, 0);
|
||||
int screen_width = common_get_width();
|
||||
|
||||
const wchar_t *left = L"left";
|
||||
const wchar_t *right = L"right";
|
||||
|
||||
for (size_t idx = 0; idx < 80; idx++)
|
||||
{
|
||||
output.push_back('A');
|
||||
}
|
||||
|
||||
if (! output.empty())
|
||||
{
|
||||
write_loop(STDOUT_FILENO, &output.at(0), output.size());
|
||||
output.clear();
|
||||
}
|
||||
|
||||
sleep(5);
|
||||
|
||||
for (size_t i=0; i < 1; i++)
|
||||
{
|
||||
writembs(cursor_left);
|
||||
}
|
||||
|
||||
if (! output.empty())
|
||||
{
|
||||
write_loop(1, &output.at(0), output.size());
|
||||
output.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c = getchar();
|
||||
if (c != EOF) break;
|
||||
}
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c = getchar();
|
||||
if (c != EOF) break;
|
||||
}
|
||||
fwprintf(stdout, L"Bye\n");
|
||||
exit(0);
|
||||
while (1) sleep(10000);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Update the screen to match the desired output.
|
||||
static void s_update(screen_t *scr, const wchar_t *left_prompt, const wchar_t *right_prompt) {
|
||||
// if (test_stuff(scr)) return;
|
||||
|
@ -741,12 +661,6 @@ static void s_update(screen_t *scr, const wchar_t *left_prompt, const wchar_t *r
|
|||
// Determine how many lines have stuff on them; we need to clear lines with stuff that we don't
|
||||
// want.
|
||||
const size_t lines_with_stuff = maxi(actual_lines_before_reset, scr->actual.line_count());
|
||||
#if 0
|
||||
if (lines_with_stuff > scr->desired.line_count()) {
|
||||
// There are lines that we output to previously that will need to be cleared.
|
||||
need_clear_lines = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (wcscmp(left_prompt, scr->actual_left_prompt.c_str())) {
|
||||
s_move(scr, &output, 0, 0);
|
||||
|
|
Loading…
Reference in a new issue