Avoid re-position in do_insert_hist

This commit is contained in:
abitmore 2019-05-04 19:52:36 -04:00
parent aa1ef33ed8
commit 9359257cac

View File

@ -580,14 +580,27 @@ const char *el_prev_hist(void)
static el_status_t do_insert_hist(const char *p) static el_status_t do_insert_hist(const char *p)
{ {
const char *pc;
if (p == NULL) if (p == NULL)
return el_ring_bell(); return el_ring_bell();
clear_line(); while (rl_point > 0)
{
--rl_point;
pc = &rl_line_buffer[rl_point];
tty_back();
if (ISCTL(*pc)) {
tty_back();
} else if (rl_meta_chars && ISMETA(*pc)) {
tty_back();
tty_back();
}
}
rl_point = 0; ceol();
reposition();
rl_end = 0; rl_end = 0;
rl_line_buffer[0] = '\0';
return insert_string(p); return insert_string(p);
} }