mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 12:31:45 +08:00
Avoid re-position in do_insert_hist
This commit is contained in:
parent
aa1ef33ed8
commit
9359257cac
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user