lineedit: de-indent large block in input_tab. No logic changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2010-09-03 14:08:24 +02:00
parent a46e16ef52
commit ba0e103a66

View File

@ -924,7 +924,7 @@ static NOINLINE int build_match_prefix(char *matchBuf)
for (i = 0; int_buf[i]; i++) { for (i = 0; int_buf[i]; i++) {
if (int_buf[i] == '(' || int_buf[i] == '{') { if (int_buf[i] == '(' || int_buf[i] == '{') {
remove_chunk(int_buf, 0, i + 1); remove_chunk(int_buf, 0, i + 1);
i = -1; /* hack increment */ i = -1; /* back to square 1 */
} }
} }
@ -1036,10 +1036,6 @@ static char *add_quote_for_spec_chars(char *found)
/* Do TAB completion */ /* Do TAB completion */
static NOINLINE void input_tab(smallint *lastWasTab) static NOINLINE void input_tab(smallint *lastWasTab)
{ {
if (!(state->flags & TAB_COMPLETION))
return;
if (!*lastWasTab) {
char *chosen_match; char *chosen_match;
size_t len_found; size_t len_found;
/* char matchBuf[MAX_LINELEN]; */ /* char matchBuf[MAX_LINELEN]; */
@ -1051,6 +1047,22 @@ static NOINLINE void input_tab(smallint *lastWasTab)
/* cursor pos in command converted to multibyte form */ /* cursor pos in command converted to multibyte form */
int cursor_mb; int cursor_mb;
#endif #endif
if (!(state->flags & TAB_COMPLETION))
return;
if (*lastWasTab) {
/* The last char was a TAB too.
* Print a list of all the available choices.
*/
if (num_matches > 0) {
/* cursor will be changed by goto_new_line() */
int sav_cursor = cursor;
goto_new_line();
showfiles();
redraw(0, command_len - sav_cursor);
}
return;
}
*lastWasTab = 1; *lastWasTab = 1;
@ -1181,18 +1193,6 @@ static NOINLINE void input_tab(smallint *lastWasTab)
#endif #endif
free(chosen_match); free(chosen_match);
#undef matchBuf #undef matchBuf
} else {
/* Ok -- the last char was a TAB. Since they
* just hit TAB again, print a list of all the
* available choices... */
if (num_matches > 0) {
/* cursor will be changed by goto_new_line() */
int sav_cursor = cursor;
goto_new_line();
showfiles();
redraw(0, command_len - sav_cursor);
}
}
} }
#endif /* FEATURE_TAB_COMPLETION */ #endif /* FEATURE_TAB_COMPLETION */