mirror of
https://github.com/troglobit/editline.git
synced 2025-06-25 01:11:12 +08:00
Fix #30: Ctrl-R with empty search string clears screen
The screen should only be cleared on Ctrl-L *and* empty regular line, not when searching with an empty string. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
0eb8f228f7
commit
0e493addab
@ -536,9 +536,9 @@ int rl_insert_text(const char *text)
|
|||||||
return rl_point - mark;
|
return rl_point - mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
static el_status_t redisplay(void)
|
static el_status_t redisplay(int cls)
|
||||||
{
|
{
|
||||||
if (rl_point == 0)
|
if (cls && rl_point == 0 && rl_end == 0)
|
||||||
tty_puts(CLEAR);
|
tty_puts(CLEAR);
|
||||||
else
|
else
|
||||||
tty_puts("\r\e[K");
|
tty_puts("\r\e[K");
|
||||||
@ -549,16 +549,21 @@ static el_status_t redisplay(void)
|
|||||||
return CSmove;
|
return CSmove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static el_status_t refresh(void)
|
||||||
|
{
|
||||||
|
return redisplay(1);
|
||||||
|
}
|
||||||
|
|
||||||
int rl_refresh_line(int ignore1 __attribute__((unused)), int ignore2 __attribute__((unused)))
|
int rl_refresh_line(int ignore1 __attribute__((unused)), int ignore2 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
redisplay();
|
redisplay(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static el_status_t toggle_meta_mode(void)
|
static el_status_t toggle_meta_mode(void)
|
||||||
{
|
{
|
||||||
rl_meta_chars = ! rl_meta_chars;
|
rl_meta_chars = ! rl_meta_chars;
|
||||||
return redisplay();
|
return redisplay(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -689,13 +694,13 @@ static el_status_t h_search_end(const char *p)
|
|||||||
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(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = search_hist(p, search_move);
|
p = search_hist(p, search_move);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
el_ring_bell();
|
el_ring_bell();
|
||||||
return redisplay();
|
return redisplay(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return do_insert_hist(p);
|
return do_insert_hist(p);
|
||||||
@ -1304,7 +1309,7 @@ void rl_clear_message(void)
|
|||||||
|
|
||||||
void rl_forced_update_display()
|
void rl_forced_update_display()
|
||||||
{
|
{
|
||||||
redisplay();
|
redisplay(0);
|
||||||
tty_flush();
|
tty_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1850,7 +1855,7 @@ static el_keymap_t Map[64] = {
|
|||||||
{ CTL('I'), c_complete },
|
{ CTL('I'), c_complete },
|
||||||
{ CTL('J'), accept_line },
|
{ CTL('J'), accept_line },
|
||||||
{ CTL('K'), kill_line },
|
{ CTL('K'), kill_line },
|
||||||
{ CTL('L'), redisplay },
|
{ CTL('L'), refresh },
|
||||||
{ CTL('M'), accept_line },
|
{ CTL('M'), accept_line },
|
||||||
{ CTL('N'), h_next },
|
{ CTL('N'), h_next },
|
||||||
{ CTL('O'), el_ring_bell },
|
{ CTL('O'), el_ring_bell },
|
||||||
|
Loading…
Reference in New Issue
Block a user