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

Re: big key binding patch



-----BEGIN PGP SIGNED MESSAGE-----

Okay, this patch fixes some problems with the key binding patch:

* Src/zle_main.c: restored Thorsten's hack to avoid an illegal
  initialiser.  And commented it (-:

* Src/zle_vi.c: the one place I forgot to keep the bindtab and
  keybindtab in synch...  This caused SEGV when pressing <ESC> in vi
  command mode.  (grep verifies that the binding tables are maintained
  together correctly everywhere else.)

* configure.in: added -pedantic to the debugging version of the automatic
  gcc flags, just to keep us honest.  Also made the automatic LDFLAGS work
  the same way as the CFLAGS, and automatically use -s when not debugging.

Just to reiterate what I said yesterday, we should *not* use the patch
to bind the ANSI arrow key sequences in vi insert mode.  It is completely
the wrong thing to do, and actually causes more problems.

 -zefram

      Index: configure.in
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/configure.in,v
      retrieving revision 1.1.1.25
      retrieving revision 1.24
      diff -c -r1.1.1.25 -r1.24
      *** configure.in	1996/11/21 00:03:36	1.1.1.25
      --- configure.in	1996/11/25 23:30:26	1.24
      ***************
      *** 183,192 ****
        dnl CHECK THE COMPILER
        dnl ------------------
        dnl We want these before the checks, so the checks can modify their values.
      ! test -z "$CFLAGS"  && CFLAGS= auto_cflags=1
      ! if test "${enable_zsh_debug}" = yes; then
      !   test -z "$LDFLAGS" && LDFLAGS=-g
      ! fi
        
        AC_PROG_CC
        
      --- 183,190 ----
        dnl CHECK THE COMPILER
        dnl ------------------
        dnl We want these before the checks, so the checks can modify their values.
      ! test -z "$CFLAGS"  && CFLAGS=  auto_cflags=1
      ! test -z "$LDFLAGS" && LDFLAGS= auto_ldflags=1
        
        AC_PROG_CC
        
      ***************
      *** 196,202 ****
        if test -n "$auto_cflags"; then
          if test "${enable_zsh_debug}" = yes; then
            if test -n "$GCC"; then
      !       CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -g"
            else
              CFLAGS="$CFLAGS -g"
            fi
      --- 194,200 ----
        if test -n "$auto_cflags"; then
          if test "${enable_zsh_debug}" = yes; then
            if test -n "$GCC"; then
      !       CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -pedantic -ggdb"
            else
              CFLAGS="$CFLAGS -g"
            fi
      ***************
      *** 206,211 ****
      --- 204,216 ----
            else
              CFLAGS="$CFLAGS -O"
            fi
      +   fi
      + fi
      + if test -n "$auto_ldflags"; then
      +   if test "${enable_zsh_debug}" = yes; then
      +     LDFLAGS=-g
      +   else
      +     LDFLAGS=-s
          fi
        fi
        
      Index: Src/zle_main.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zle_main.c,v
      retrieving revision 1.30
      diff -c -r1.30 zle_main.c
      *** Src/zle_main.c	1996/11/25 23:23:14	1.30
      --- Src/zle_main.c	1996/11/25 23:48:41
      ***************
      *** 1305,1317 ****
        {
            int i, *tab = 0;
            HashTable keytab = NULL;
            struct {
        	int *tab;
      ! 	HashTable keytab;
            } list[] = {
      ! 	{ altbindtab, altkeybindtab },
      ! 	{ embindtab, emkeybindtab },
      ! 	{ vibindtab, vikeybindtab },
        	{ NULL, NULL }
            }, *ptr;
        
      --- 1305,1319 ----
        {
            int i, *tab = 0;
            HashTable keytab = NULL;
      +     /* N.B. we can't put the HashTable values in this table directly,  *
      +      * because ANSI C doesn't allow non-static aggregate initialisers. */
            struct {
        	int *tab;
      ! 	HashTable *keytabp;
            } list[] = {
      ! 	{ altbindtab, &altkeybindtab },
      ! 	{ embindtab,  &emkeybindtab  },
      ! 	{ vibindtab,  &vikeybindtab  },
        	{ NULL, NULL }
            }, *ptr;
        
      ***************
      *** 1325,1331 ****
        
        	    if(!(notall & 3)) {
        		tab = ptr->tab;
      ! 		keytab = ptr->keytab;
        	    }
        
        	    /*
      --- 1327,1333 ----
        
        	    if(!(notall & 3)) {
        		tab = ptr->tab;
      ! 		keytab = *ptr->keytabp;
        	    }
        
        	    /*
      Index: Src/zle_vi.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zle_vi.c,v
      retrieving revision 1.18
      diff -c -r1.18 zle_vi.c
      *** Src/zle_vi.c	1996/11/21 01:33:18	1.18
      --- Src/zle_vi.c	1996/11/25 23:42:30
      ***************
      *** 496,501 ****
      --- 496,502 ----
        	feep();
            else {
        	bindtab = altbindtab;
      + 	keybindtab = altkeybindtab;
        	undoing = 1;
        	vichgflag = 0;
        	if (cs != findbol())

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMpo15HD/+HJTpU/hAQGtNwP8CIjBDQuB8UcaRl111osw6Wp57Nix10T5
64uhvlhgzMn8/PJdJEzgXpuphGD84wUhg3oLobxKS9q9VKpYKD2W5YrzRriHccRZ
XNZqXsxdytbqHeO3DU5vpRqllVkD8Rgmdc3Nmhcm4XB8BKBFJGLYEUQe4lBIBft4
kimueDOZOts=
=8ehV
-----END PGP SIGNATURE-----



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