summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-08-15 10:01:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-08-15 10:01:47 +0000
commit243539fa30b49d6e9f6c6a39257b35a9e2b70044 (patch)
treebab07ee16f6a8b1fe7db42cb5d5163156248a46d
parent76364d31193ae8cd87a2e92cf2dfe3fb1601fc02 (diff)
downloadzsh-243539fa30b49d6e9f6c6a39257b35a9e2b70044.tar.gz
zsh-243539fa30b49d6e9f6c6a39257b35a9e2b70044.zip
21610: Turn on ZLE_UNICODE_SUPPORT and fix a few related problems.
-rw-r--r--ChangeLog7
-rw-r--r--Src/Zle/zle_hist.c23
-rw-r--r--Src/Zle/zle_keymap.c4
-rw-r--r--Src/Zle/zle_misc.c19
-rw-r--r--Src/system.h2
5 files changed, 42 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 1338b854b..f02c18c7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-15 Peter Stephenson <pws@csr.com>
+
+ * 21610: Src/system.h, Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c,
+ Src/Zle/zle_misc.c: Turn on ZLE_UNICODE_SUPPORT by default where
+ allowed; fix suffix removal; fix metafication when removing
+ suffix by function; fix insert-last-word.
+
2005-08-14 Bart Schaefer <schaefer@zsh.org>
* 21369: Completion/Unix/Command/_cvs: assign to array with
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 7bb5f43a6..f529e7820 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -531,10 +531,11 @@ insertlastword(char **args)
}
}
+ metafy_line();
if (lastinsert && lastlen &&
- lastpos <= zlecs &&
- lastlen == zlecs - lastpos &&
- memcmp(lastinsert, (char *)&zleline[lastpos], lastlen) == 0)
+ lastpos <= zlemetacs &&
+ lastlen == zlemetacs - lastpos &&
+ memcmp(lastinsert, (char *)&zlemetaline[lastpos], lastlen) == 0)
deleteword = 1;
else
lasthist = curhist;
@@ -548,9 +549,9 @@ insertlastword(char **args)
* confusion.
*/
if (deleteword) {
- int pos = zlecs;
- zlecs = lastpos;
- foredel(pos - zlecs);
+ int pos = zlemetacs;
+ zlemetacs = lastpos;
+ foredel(pos - zlemetacs);
/*
* Mark that this has been deleted.
* For consistency with history lines, we really ought to
@@ -604,9 +605,9 @@ insertlastword(char **args)
* successfully found a new one to insert.
*/
if (deleteword > 0) {
- int pos = zlecs;
- zlecs = lastpos;
- foredel(pos - zlecs);
+ int pos = zlemetacs;
+ zlemetacs = lastpos;
+ foredel(pos - zlemetacs);
}
if (lastinsert) {
zfree(lastinsert, lastlen);
@@ -625,13 +626,15 @@ insertlastword(char **args)
save = *t;
*t = '\0'; /* ignore trailing whitespace */
lasthist = evhist;
- lastpos = zlecs;
+ lastpos = zlemetacs;
lastlen = t - s;
lastinsert = zalloc(t - s);
memcpy(lastinsert, s, lastlen);
n = zmult;
zmult = 1;
+ unmetafy_line();
+
zs = stringaszleline((unsigned char *)s, 0, &len, NULL, NULL);
doinsert(zs, len);
free(zs);
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 9b83a4953..6f4e062fc 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -818,6 +818,10 @@ bin_bindkey_meta(char *name, char *kmname, Keymap km, UNUSED(char **argv), UNUSE
zwarnnam(name, "keymap `%s' is protected", kmname, 0);
return 1;
}
+#ifdef ZLE_UNICODE_SUPPORT
+ zwarnnam(name, "warning: `bindkey -m' disables multibyte support",
+ NULL, 0);
+#endif
for(i = 128; i < 256; i++)
if(metabind[i - 128] != z_undefinedkey) {
m[0] = i;
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 9ade372b1..58345ac05 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -30,7 +30,7 @@
#include "zle.mdh"
#include "zle_misc.pro"
-/* insert a metafied string, with repetition and suffix removal */
+/* insert a zle string, with repetition and suffix removal */
/**/
void
@@ -1107,6 +1107,18 @@ iremovesuffix(ZLE_CHAR_T c, int keep)
LinkList args = newlinklist();
char buf[20];
int osc = sfcontext;
+ int wasmeta = (zlemetaline != 0);
+
+ if (wasmeta) {
+ /*
+ * The suffix removal function runs as a normal
+ * ZLE function, not a completion function, so
+ * the line should be unmetafied if this was
+ * called from completion. (It may not be since
+ * we may decide to remove the suffix later.)
+ */
+ umetafy_line();
+ }
sprintf(buf, "%d", suffixlen[0]);
addlinknode(args, suffixfunc);
@@ -1118,13 +1130,16 @@ iremovesuffix(ZLE_CHAR_T c, int keep)
doshfunc(suffixfunc, prog, args, 0, 1);
sfcontext = osc;
endparamscope();
+
+ if (wasmeta)
+ metafy_line();
}
zsfree(suffixfunc);
suffixfunc = NULL;
} else {
#ifdef ZLE_UNICODE_SUPPORT
/* TODO: best I can think of for now... */
- int sl = (unsigned int)c < 256 ? suffixlen[c] : 0;
+ int sl = (unsigned int)c <= 256 ? suffixlen[c] : 0;
#else
int sl = suffixlen[c];
#endif
diff --git a/Src/system.h b/Src/system.h
index 04a21edd8..0c3215d84 100644
--- a/Src/system.h
+++ b/Src/system.h
@@ -705,7 +705,7 @@ extern short ospeed;
* between wide characters and multibyte strings.
*/
#if defined(HAVE_MBRTOWC) && defined(HAVE_WCRTOMB)
-/*#define ZLE_UNICODE_SUPPORT 1*/
+#define ZLE_UNICODE_SUPPORT 1
#endif
#else
# ifdef HAVE_LANGINFO_H