Minor whitespace fixes/cleanup

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2017-11-29 15:01:22 +01:00
parent 2a3b422137
commit ed37cef412
2 changed files with 12 additions and 3 deletions

View File

@ -654,22 +654,27 @@ static el_status_t h_search(void)
old_prompt = rl_prompt; old_prompt = rl_prompt;
rl_prompt = "Search: "; rl_prompt = "Search: ";
tty_puts(rl_prompt); tty_puts(rl_prompt);
move = Repeat == NO_ARG ? prev_hist : next_hist; move = Repeat == NO_ARG ? prev_hist : next_hist;
p = editinput(); p = editinput();
rl_prompt = old_prompt; rl_prompt = old_prompt;
Searching = 0; Searching = 0;
tty_puts(rl_prompt); tty_puts(rl_prompt);
if (p == NULL && el_intr_pending > 0) { if (p == NULL && el_intr_pending > 0) {
el_intr_pending = 0; el_intr_pending = 0;
clear_line(); clear_line();
return redisplay(); return redisplay();
} }
p = search_hist(p, move); p = search_hist(p, move);
clear_line(); clear_line();
if (p == NULL) { if (p == NULL) {
el_ring_bell(); el_ring_bell();
return redisplay(); return redisplay();
} }
return do_insert_hist(p); return do_insert_hist(p);
} }
@ -1023,6 +1028,7 @@ static char *editinput(void)
break; break;
} }
} }
return NULL; return NULL;
} }
@ -1046,6 +1052,7 @@ static void hist_add(const char *p)
if ((s = strdup(p)) == NULL) if ((s = strdup(p)) == NULL)
return; return;
if (H.Size < el_hist_size) { if (H.Size < el_hist_size) {
H.Lines[H.Size++] = s; H.Lines[H.Size++] = s;
} else { } else {
@ -1272,8 +1279,10 @@ char *readline(const char *prompt)
return line; return line;
} }
/* Even though readline() itself adds history automatically, the user can also add /*
* lines. This is for compat with GNU Readline. */ * Even though readline() itself adds history automatically, the user
* can also add lines. This is for compatibility with GNU Readline.
*/
void add_history(const char *p) void add_history(const char *p)
{ {
if (p == NULL || *p == '\0') if (p == NULL || *p == '\0')