Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

spellchecker for users of dvorak layout



Hi, I'm a new comer of this mailing list.
I decided to subscribe this ML to propose a new function of the Z
shell.

I'm a user of dvorak key layout, so sometimes annoyed with
spellchecker which is fixed to qwerty layout. So I modified the source
codes of 3.1.7-pre-1 to be able to change the layout table dynamically
by typing `setopt dvorak'.

How about this function?

I modified Src/{zsh.h,options.c,utils.c}.
I'll put some patches in this mail.
(I don't know the correct usage of diff command, sorry.)


--- Src/zsh.h.orig	Thu Apr 20 04:03:47 2000
+++ Src/zsh.h	Tue May  2 02:05:48 2000
@@ -1431,6 +1431,7 @@
     VERBOSE,
     XTRACE,
     USEZLE,
+    DVORAK,
     OPT_SIZE
 };
 
--- Src/options.c.orig	Thu Apr 20 04:03:46 2000
+++ Src/options.c	Tue May  2 01:42:16 2000
@@ -210,6 +210,7 @@
 {NULL, "promptvars",	      OPT_ALIAS, /* bash */	 PROMPTSUBST},
 {NULL, "stdin",		      OPT_ALIAS, /* ksh */	 SHINSTDIN},
 {NULL, "trackall",	      OPT_ALIAS, /* ksh */	 HASHCMDS},
+{NULL, "dvorak",	      0,			 DVORAK},
 {NULL, NULL, 0, 0}
 };
 
--- Src/utils.c.orig	Thu Apr  6 04:36:54 2000
+++ Src/utils.c	Tue May  2 02:20:02 2000
@@ -2127,7 +2127,7 @@
 spdist(char *s, char *t, int thresh)
 {
     char *p, *q;
-    char *keymap =
+    const char qwertykeymap[] =
     "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
 \t1234567890-=\t\
 \tqwertyuiop[]\t\
@@ -2139,6 +2139,23 @@
 \tASDFGHJKL:\"\n\t\
 \tZXCVBNM<>?\n\n\t\
 \n\n\n\n\n\n\n\n\n\n\n\n\n\n";
+    const char dvorakkeymap[] =
+    "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
+\t1234567890[]\t\
+\t',.pyfgcrl/=\t\
+\taoeuidhtns-\n\t\
+\t;qjkxbmwvz\t\t\t\
+\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
+\t!@#$%^&*(){}\t\
+\t\"<>PYFGCRL?+\t\
+\tAOEUIDHTNS_\n\t\
+\t:QJKXBMWVZ\n\n\t\
+\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
+    const char *keymap;
+    if ( isset( DVORAK ) )
+      keymap = dvorakkeymap;
+    else
+      keymap = qwertykeymap;
 
     if (!strcmp(s, t))
 	return 0;



Messages sorted by: Reverse Date, Date, Thread, Author