summaryrefslogtreecommitdiff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_keymap.c2
-rw-r--r--Src/Zle/zle_main.c27
-rw-r--r--Src/Zle/zle_misc.c2
-rw-r--r--Src/Zle/zle_vi.c2
4 files changed, 23 insertions, 10 deletions
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 454e26f16..3c8cc4d9d 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1363,7 +1363,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
static int
getkeybuf(int w)
{
- int c = getbyte(w, NULL);
+ int c = getbyte((long)w, NULL);
if(c < 0)
return EOF;
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 5c36f4557..430c4345a 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -451,13 +451,22 @@ struct ztmout {
/*
* See if we need a timeout either for a key press or for a
* timed function.
+ *
+ * do_keytmout is passed down from getbyte() here. If it is positive,
+ * we the keytimeout value, which is in 100ths of a second (directly set
+ * from the parameter). If it is negative, we use -(do_keytmout+1)
+ * (i.e. the one's complement, to allow a zero value to be set). This
+ * is only used when calling into zle from outside to specify an
+ * explicit timeout. This is also in 100ths of a second.
*/
static void
-calc_timeout(struct ztmout *tmoutp, int do_keytmout)
+calc_timeout(struct ztmout *tmoutp, long do_keytmout)
{
- if (do_keytmout && keytimeout > 0) {
- if (keytimeout > ZMAXTIMEOUT * 100 /* 24 days for a keypress???? */)
+ if (do_keytmout && (keytimeout > 0 || do_keytmout < 0)) {
+ if (do_keytmout < 0)
+ tmoutp->exp100ths = (time_t)-do_keytmout;
+ else if (keytimeout > ZMAXTIMEOUT * 100 /* 24 days for a keypress???? */)
tmoutp->exp100ths = ZMAXTIMEOUT * 100;
else
tmoutp->exp100ths = keytimeout;
@@ -501,8 +510,10 @@ calc_timeout(struct ztmout *tmoutp, int do_keytmout)
}
}
+/* see calc_timeout for use of do_keytmout */
+
static int
-raw_getbyte(int do_keytmout, char *cptr)
+raw_getbyte(long do_keytmout, char *cptr)
{
int ret;
struct ztmout tmout;
@@ -785,9 +796,11 @@ raw_getbyte(int do_keytmout, char *cptr)
return ret;
}
+/* see calc_timeout for use of do_keytmout */
+
/**/
mod_export int
-getbyte(int do_keytmout, int *timeout)
+getbyte(long do_keytmout, int *timeout)
{
char cc;
unsigned int ret;
@@ -899,7 +912,7 @@ getbyte(int do_keytmout, int *timeout)
mod_export ZLE_INT_T
getfullchar(int do_keytmout)
{
- int inchar = getbyte(do_keytmout, NULL);
+ int inchar = getbyte((long)do_keytmout, NULL);
#ifdef MULTIBYTE_SUPPORT
return getrestchar(inchar);
@@ -962,7 +975,7 @@ getrestchar(int inchar)
* arrive together. If we don't do this the input can
* get stuck if an invalid byte sequence arrives.
*/
- inchar = getbyte(1, &timeout);
+ inchar = getbyte(1L, &timeout);
/* getbyte deliberately resets lastchar_wide_valid */
lastchar_wide_valid = 1;
if (inchar == EOF) {
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index f4c32e454..6a42f157e 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -619,7 +619,7 @@ universalargument(char **args)
*
* Hence for now this remains byte-by-byte.
*/
- while ((gotk = getbyte(0, NULL)) != EOF) {
+ while ((gotk = getbyte(0L, NULL)) != EOF) {
if (gotk == '-' && !digcnt) {
minus = -1;
digcnt++;
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 2549af80c..3e8e5ccec 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -108,7 +108,7 @@ vigetkey(void)
char m[3], *str;
Thingy cmd;
- if (getbyte(0, NULL) == EOF)
+ if (getbyte(0L, NULL) == EOF)
return ZLEEOF;
m[0] = lastchar;