mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-13 01:31:18 +02:00
Don't handle ZLE functions for single key.
For read -k and read -q where we use ZLE, we just want a single key and not full ZLE processing. So don't handle timed ZLE functions when preforming the read.
This commit is contained in:
parent
014eaf7e81
commit
3ad2ca3305
5 changed files with 22 additions and 16 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2018-09-03 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
|
* 43365: Src/Zle/zle_keymap.c, Src/Zle/zle_main.c,
|
||||||
|
Src/Zle/zle_misc.c, Src/Zle/zle_vi.c: Don't handle ZLE timed
|
||||||
|
functions if just reading a single key.
|
||||||
|
|
||||||
2018-08-31 Oliver Kiddle <okiddle@yahoo.co.uk>
|
2018-08-31 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||||
|
|
||||||
* 43358: Src/zsh.mdd: enforce consistent patchlevel form
|
* 43358: Src/zsh.mdd: enforce consistent patchlevel form
|
||||||
|
|
|
@ -1518,7 +1518,7 @@ getrestchar_keybuf(void)
|
||||||
* arrive together. If we don't do this the input can
|
* arrive together. If we don't do this the input can
|
||||||
* get stuck if an invalid byte sequence arrives.
|
* get stuck if an invalid byte sequence arrives.
|
||||||
*/
|
*/
|
||||||
inchar = getbyte(1L, &timeout);
|
inchar = getbyte(1L, &timeout, 1);
|
||||||
/* getbyte deliberately resets lastchar_wide_valid */
|
/* getbyte deliberately resets lastchar_wide_valid */
|
||||||
lastchar_wide_valid = 1;
|
lastchar_wide_valid = 1;
|
||||||
if (inchar == EOF) {
|
if (inchar == EOF) {
|
||||||
|
@ -1673,7 +1673,7 @@ addkeybuf(int c)
|
||||||
static int
|
static int
|
||||||
getkeybuf(int w)
|
getkeybuf(int w)
|
||||||
{
|
{
|
||||||
int c = getbyte((long)w, NULL);
|
int c = getbyte((long)w, NULL, 1);
|
||||||
|
|
||||||
if(c < 0)
|
if(c < 0)
|
||||||
return EOF;
|
return EOF;
|
||||||
|
|
|
@ -452,7 +452,7 @@ struct ztmout {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calc_timeout(struct ztmout *tmoutp, long do_keytmout)
|
calc_timeout(struct ztmout *tmoutp, long do_keytmout, int full)
|
||||||
{
|
{
|
||||||
if (do_keytmout && (keytimeout > 0 || do_keytmout < 0)) {
|
if (do_keytmout && (keytimeout > 0 || do_keytmout < 0)) {
|
||||||
if (do_keytmout < 0)
|
if (do_keytmout < 0)
|
||||||
|
@ -465,7 +465,7 @@ calc_timeout(struct ztmout *tmoutp, long do_keytmout)
|
||||||
} else
|
} else
|
||||||
tmoutp->tp = ZTM_NONE;
|
tmoutp->tp = ZTM_NONE;
|
||||||
|
|
||||||
if (timedfns) {
|
if (full && timedfns) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
LinkNode tfnode = firstnode(timedfns);
|
LinkNode tfnode = firstnode(timedfns);
|
||||||
Timedfn tfdat;
|
Timedfn tfdat;
|
||||||
|
@ -504,7 +504,7 @@ calc_timeout(struct ztmout *tmoutp, long do_keytmout)
|
||||||
/* see calc_timeout for use of do_keytmout */
|
/* see calc_timeout for use of do_keytmout */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
raw_getbyte(long do_keytmout, char *cptr)
|
raw_getbyte(long do_keytmout, char *cptr, int full)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct ztmout tmout;
|
struct ztmout tmout;
|
||||||
|
@ -519,7 +519,7 @@ raw_getbyte(long do_keytmout, char *cptr)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
calc_timeout(&tmout, do_keytmout);
|
calc_timeout(&tmout, do_keytmout, full);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle timeouts and watched fd's. If a watched fd or a function
|
* Handle timeouts and watched fd's. If a watched fd or a function
|
||||||
|
@ -684,7 +684,7 @@ raw_getbyte(long do_keytmout, char *cptr)
|
||||||
* reconsider the key timeout from scratch.
|
* reconsider the key timeout from scratch.
|
||||||
* The effect of this is microscopic.
|
* The effect of this is microscopic.
|
||||||
*/
|
*/
|
||||||
calc_timeout(&tmout, do_keytmout);
|
calc_timeout(&tmout, do_keytmout, full);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -810,7 +810,7 @@ raw_getbyte(long do_keytmout, char *cptr)
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
/* If looping, need to recalculate timeout */
|
/* If looping, need to recalculate timeout */
|
||||||
calc_timeout(&tmout, do_keytmout);
|
calc_timeout(&tmout, do_keytmout, full);
|
||||||
}
|
}
|
||||||
# ifdef HAVE_POLL
|
# ifdef HAVE_POLL
|
||||||
zfree(fds, sizeof(struct pollfd) * nfds);
|
zfree(fds, sizeof(struct pollfd) * nfds);
|
||||||
|
@ -852,7 +852,7 @@ raw_getbyte(long do_keytmout, char *cptr)
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
mod_export int
|
mod_export int
|
||||||
getbyte(long do_keytmout, int *timeout)
|
getbyte(long do_keytmout, int *timeout, int full)
|
||||||
{
|
{
|
||||||
char cc;
|
char cc;
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
|
@ -877,7 +877,7 @@ getbyte(long do_keytmout, int *timeout)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int q = queue_signal_level();
|
int q = queue_signal_level();
|
||||||
dont_queue_signals();
|
dont_queue_signals();
|
||||||
r = raw_getbyte(do_keytmout, &cc);
|
r = raw_getbyte(do_keytmout, &cc, full);
|
||||||
restore_queue_signals(q);
|
restore_queue_signals(q);
|
||||||
if (r == -2) {
|
if (r == -2) {
|
||||||
/* timeout */
|
/* timeout */
|
||||||
|
@ -956,7 +956,7 @@ getbyte(long do_keytmout, int *timeout)
|
||||||
mod_export ZLE_INT_T
|
mod_export ZLE_INT_T
|
||||||
getfullchar(int do_keytmout)
|
getfullchar(int do_keytmout)
|
||||||
{
|
{
|
||||||
int inchar = getbyte((long)do_keytmout, NULL);
|
int inchar = getbyte((long)do_keytmout, NULL, 1);
|
||||||
|
|
||||||
#ifdef MULTIBYTE_SUPPORT
|
#ifdef MULTIBYTE_SUPPORT
|
||||||
return getrestchar(inchar, NULL, NULL);
|
return getrestchar(inchar, NULL, NULL);
|
||||||
|
@ -1021,7 +1021,7 @@ getrestchar(int inchar, char *outstr, int *outcount)
|
||||||
* arrive together. If we don't do this the input can
|
* arrive together. If we don't do this the input can
|
||||||
* get stuck if an invalid byte sequence arrives.
|
* get stuck if an invalid byte sequence arrives.
|
||||||
*/
|
*/
|
||||||
inchar = getbyte(1L, &timeout);
|
inchar = getbyte(1L, &timeout, 1);
|
||||||
/* getbyte deliberately resets lastchar_wide_valid */
|
/* getbyte deliberately resets lastchar_wide_valid */
|
||||||
lastchar_wide_valid = 1;
|
lastchar_wide_valid = 1;
|
||||||
if (inchar == EOF) {
|
if (inchar == EOF) {
|
||||||
|
@ -2139,7 +2139,7 @@ zle_main_entry(int cmd, va_list ap)
|
||||||
do_keytmout = va_arg(ap, long);
|
do_keytmout = va_arg(ap, long);
|
||||||
timeout = va_arg(ap, int *);
|
timeout = va_arg(ap, int *);
|
||||||
chrp = va_arg(ap, int *);
|
chrp = va_arg(ap, int *);
|
||||||
*chrp = getbyte(do_keytmout, timeout);
|
*chrp = getbyte(do_keytmout, timeout, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -756,7 +756,7 @@ bracketedstring(void)
|
||||||
while (endesc[endpos]) {
|
while (endesc[endpos]) {
|
||||||
if (current + 1 >= psize)
|
if (current + 1 >= psize)
|
||||||
pbuf = zrealloc(pbuf, psize *= 2);
|
pbuf = zrealloc(pbuf, psize *= 2);
|
||||||
if ((next = getbyte(1L, &timeout)) == EOF)
|
if ((next = getbyte(1L, &timeout, 1)) == EOF)
|
||||||
break;
|
break;
|
||||||
if (!endpos || next != endesc[endpos++])
|
if (!endpos || next != endesc[endpos++])
|
||||||
endpos = (next == *endesc);
|
endpos = (next == *endesc);
|
||||||
|
@ -970,7 +970,7 @@ universalargument(char **args)
|
||||||
*
|
*
|
||||||
* Hence for now this remains byte-by-byte.
|
* Hence for now this remains byte-by-byte.
|
||||||
*/
|
*/
|
||||||
while ((gotk = getbyte(0L, NULL)) != EOF) {
|
while ((gotk = getbyte(0L, NULL, 1)) != EOF) {
|
||||||
if (gotk == '-' && !digcnt) {
|
if (gotk == '-' && !digcnt) {
|
||||||
minus = -1;
|
minus = -1;
|
||||||
digcnt++;
|
digcnt++;
|
||||||
|
|
|
@ -131,7 +131,7 @@ vigetkey(void)
|
||||||
char m[3], *str;
|
char m[3], *str;
|
||||||
Thingy cmd;
|
Thingy cmd;
|
||||||
|
|
||||||
if (getbyte(0L, NULL) == EOF)
|
if (getbyte(0L, NULL, 1) == EOF)
|
||||||
return ZLEEOF;
|
return ZLEEOF;
|
||||||
|
|
||||||
m[0] = lastchar;
|
m[0] = lastchar;
|
||||||
|
|
Loading…
Reference in a new issue