summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2005-11-01 03:26:52 +0000
committerWayne Davison <wayned@users.sourceforge.net>2005-11-01 03:26:52 +0000
commitb0439695700b04faf560ee1d484a98e3b1ccbe16 (patch)
treeb4309cf0e00d59b79f2cce095beaff6dafc4ee90
parentee324f449eb777a964649348e80cef979cbf797b (diff)
downloadzsh-b0439695700b04faf560ee1d484a98e3b1ccbe16.tar.gz
zsh-b0439695700b04faf560ee1d484a98e3b1ccbe16.tar.xz
zsh-b0439695700b04faf560ee1d484a98e3b1ccbe16.zip
- A few changes in light of the new ZLE_CHAR_T and ZLE_STRING_T.
- Use idigit() in place of some former '0' - '9' range checks.
- Simplified some multibyte conditional code by using ZC_icntrl()
  and LASTFULLCHAR.
-rw-r--r--Src/Zle/zle_misc.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 75b907f32..0a7b5084f 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -60,18 +60,14 @@ doinsert(ZLE_STRING_T zstr, int len)
 mod_export int
 selfinsert(UNUSED(char **args))
 {
-#ifdef MULTIBYTE_SUPPORT
-    /* wint_t and wchar_t not neccessarily the same size */
-    wchar_t tmp;
+    ZLE_CHAR_T tmp;
 
+#ifdef MULTIBYTE_SUPPORT
     if (!lastchar_wide_valid)
 	getrestchar(lastchar);
-    tmp = lastchar_wide;
-    doinsert(&tmp, 1);
-#else
-    unsigned char s = lastchar;
-    doinsert(&s, 1);
 #endif
+    tmp = LASTFULLCHAR;
+    doinsert(&tmp, 1);
     return 0;
 }
 
@@ -89,7 +85,7 @@ fixunmeta(void)
      * selfinsertunmeta is intrinsically problematic
      * with multibyte input.
      */
-    lastchar_wide = (ZLE_CHAR_T)lastchar;
+    lastchar_wide = (ZLE_INT_T)lastchar;
     lastchar_wide_valid = 1;
 #endif
 }
@@ -536,11 +532,11 @@ digitargument(UNUSED(char **args))
      * of digits.  We are assuming ASCII is a subset of the multibyte
      * encoding.
      */
-    if (lastchar < '0' || lastchar > '9')
+    if (idigit(lastchar))
 	return 1;
 #else
     /* allow metafied as well as ordinary digits */
-    if ((lastchar & 0x7f) < '0' || (lastchar & 0x7f) > '9')
+    if (idigit(lastchar & 0x7f))
 	return 1;
 #endif
 
@@ -599,7 +595,7 @@ universalargument(char **args)
 	if (gotk == '-' && !digcnt) {
 	    minus = -1;
 	    digcnt++;
-	} else if (gotk >= '0' && gotk <= '9') {
+	} else if (idigit(gotk)) {
 	    pref = pref * 10 + (gotk & 0xf);
 	    digcnt++;
 	} else {
@@ -956,16 +952,11 @@ executenamedcommand(char *prmt)
 #ifdef MULTIBYTE_SUPPORT
 		    if (!lastchar_wide_valid)
 			getrestchar(lastchar);
-		    if (iswcntrl(lastchar_wide))
-#else
-		    if (icntrl(lastchar))
 #endif
-		    {
+		    if (ZC_icntrl(LASTFULLCHAR))
 			feep = 1;
-		    }
-		    else {
+		    else
 			*ptr++ = LASTFULLCHAR, len++, curlist = 0;
-		    }
 		}
 	    }
 	}
@@ -1098,7 +1089,7 @@ makesuffixstr(char *f, char *s, int n)
 
 /**/
 mod_export void
-iremovesuffix(ZLE_CHAR_T c, int keep)
+iremovesuffix(ZLE_INT_T c, int keep)
 {
     if (suffixfunc) {
 	Eprog prog = getshfunc(suffixfunc);