when using search-history, ESC ends the search, however, ESC often leads
in præfix sequences (like ANSI cursor keys), leading to annoying effects if we forget that this patch changes the behaviour so that another character is read/peeked at (since this is done in the main loop after ESC anyway, no function loss through the delay) if ESC leads in a prefix-1 sequence, and if the peeked character leads in a prefix-1 or prefix-2 sequence when in state prefix-1, it’s still enacted (XXX document this in manpage)
This commit is contained in:
parent
3287571386
commit
09bfec553e
17
edit.c
17
edit.c
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.130 2008/09/20 14:10:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.131 2008/09/20 15:59:23 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -2150,14 +2150,23 @@ x_search_hist(int c)
|
||||||
if ((c = x_e_getc()) < 0)
|
if ((c = x_e_getc()) < 0)
|
||||||
return KSTD;
|
return KSTD;
|
||||||
f = x_tab[0][c];
|
f = x_tab[0][c];
|
||||||
|
if (c == MKCTRL('[')) {
|
||||||
|
if ((f & 0x7F) == XFUNC_meta1) {
|
||||||
|
if ((c = x_e_getc()) < 0)
|
||||||
|
return KSTD;
|
||||||
|
f = x_tab[1][c] & 0x7F;
|
||||||
|
if (f == XFUNC_meta1 || f == XFUNC_meta2)
|
||||||
|
x_meta1(MKCTRL('['));
|
||||||
|
x_e_ungetc(c);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (f & 0x80) {
|
if (f & 0x80) {
|
||||||
f &= 0x7F;
|
f &= 0x7F;
|
||||||
if ((c = x_e_getc()) != '~')
|
if ((c = x_e_getc()) != '~')
|
||||||
x_e_ungetc(c);
|
x_e_ungetc(c);
|
||||||
}
|
}
|
||||||
if (c == MKCTRL('['))
|
if (f == XFUNC_search_hist)
|
||||||
break;
|
|
||||||
else if (f == XFUNC_search_hist)
|
|
||||||
offset = x_search(pat, 0, offset);
|
offset = x_search(pat, 0, offset);
|
||||||
else if (f == XFUNC_del_back) {
|
else if (f == XFUNC_del_back) {
|
||||||
if (p == pat) {
|
if (p == pat) {
|
||||||
|
|
Loading…
Reference in New Issue