about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2005-04-08 16:42:55 +0000
committerClint Adams <clint@users.sourceforge.net>2005-04-08 16:42:55 +0000
commit5571605340689945ec194abbec764829bb8efa48 (patch)
tree76134fad839f54469137b3d622de4ca80e23433d
parentcb19345676bc176c70d57bcc1bc348592cfd06eb (diff)
downloadzsh-5571605340689945ec194abbec764829bb8efa48.tar.gz
zsh-5571605340689945ec194abbec764829bb8efa48.tar.xz
zsh-5571605340689945ec194abbec764829bb8efa48.zip
* 21124: Src/Zle/zle_main.c, Src/init.c, Src/params.c: have zle cache a
 wide-char version of WORDCHARS each time it's changed (when ZLE_UNICODE_SUPPORT
 is defined).
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/zle_main.c18
-rw-r--r--Src/init.c3
-rw-r--r--Src/params.c1
4 files changed, 28 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e0ad7a218..6d15b4b1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-08  Clint Adams  <clint@zsh.org>
+
+	* 21124: Src/Zle/zle_main.c, Src/init.c, Src/params.c:
+	have zle cache a wide-char version of WORDCHARS each time
+	it's changed (when ZLE_UNICODE_SUPPORT is defined).
+
 2005-04-08  Oliver Kiddle  <opk@zsh.org>
 
 	* 21107: configure.ac: handle case where there is a native iconv
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index aa36901ed..1d5902c14 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -101,6 +101,11 @@ mod_export ZLE_INT_T lastchar_wide;
 /**/
 mod_export int
 lastchar_wide_valid;
+
+/**/
+mod_export ZLE_STRING_T zle_wordchars;
+#else
+# define zle_wordchars wordchars;
 #endif
 
 /* the bindings for the previous and for this key */
@@ -1507,6 +1512,17 @@ trashzle(void)
 	kungetct = 0;
 }
 
+/**/
+mod_export void
+wordcharstrigger(void)
+{
+#ifdef ZLE_UNICODE_SUPPORT
+    zrealloc(zle_wordchars, strlen(wordchars)*MB_CUR_MAX);
+    mbsrtowcs(zle_wordchars, &wordchars, strlen(wordchars), NULL);
+    /* TODO: error handling here */
+#endif
+}
+
 /* Hook functions. Used to allow access to zle parameters if zle is
  * active. */
 
@@ -1572,6 +1588,7 @@ setup_(UNUSED(Module m))
     kungetbuf = (char *) zalloc(kungetsz = 32);
     comprecursive = 0;
     rdstrs = NULL;
+    wordcharstriggerptr = wordcharstrigger;
 
     /* initialise the keymap system */
     init_keymaps();
@@ -1645,6 +1662,7 @@ finish_(UNUSED(Module m))
     zlegetlineptr = NULL;
     zlereadptr = fallback_zleread;
     zlesetkeymapptr= noop_function_int;
+    wordcharstriggerptr = noop_function;
 
     getkeyptr = NULL;
 
diff --git a/Src/init.c b/Src/init.c
index 1ad9559f0..965f47174 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1152,6 +1152,9 @@ mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
 #endif /* !LINKED_XMOD_zshQszle */
 
 /**/
+mod_export ZleVoidFn wordcharstriggerptr = noop_function;
+
+/**/
 unsigned char *
 autoload_zleread(char **lp, char **rp, int ha, int con)
 {
diff --git a/Src/params.c b/Src/params.c
index a233df90d..354d8d941 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3316,6 +3316,7 @@ wordcharssetfn(UNUSED(Param pm), char *x)
     zsfree(wordchars);
     wordchars = x;
     inittyptab();
+    wordcharstriggerptr();
 }
 
 /* Function to get value for special parameter `_' */