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

Fix for a ZLE bug



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

There's been a weird bug in ZLE for a while.  The symptom is that if
one does a vi range command (e.g. cw), and the movement command moves
forward to offset 26 in the buffer, the command is applied to the
entire line instead of just the requested range.  The cause is an error
in the vi range logic.  The patch below fixes it.  I made this patch
with a beta14 patched with the ZLE changes I have already posted, but
it should apply cleanly to straight beta14 and to Zoltan's recent
releases.

Would anyone find it useful if I post all my pending ZLE changes in one
large patch?
      
      Index: Src/zle_vi.c
      *** Src/zle_vi.c	1996/04/16 22:17:21	1.3
      --- Src/zle_vi.c	1996/04/18 16:17:10
      ***************
      *** 236,244 ****
        
            /* get the range the right way round */
            if (cs > t0) {
      ! 	k2 = cs;
        	cs = t0;
      ! 	t0 = k2;
            }
        
            /* Was it a line-oriented move?  In this case, entire lines are taken.  The
      --- 236,244 ----
        
            /* get the range the right way round */
            if (cs > t0) {
      ! 	int tmp = cs;
        	cs = t0;
      ! 	t0 = tmp;
            }
        
            /* Was it a line-oriented move?  In this case, entire lines are taken.  The
      ***************
      *** 246,256 ****
            deal with appropriately.  At this point we just need to make the range
            encompass entire lines. */
            if (zlecmds[k2].flags & ZLE_LINEMOVE) {
      ! 	vilinerange = 1;
      ! 	k2 = findbol();
        	cs = t0;
        	t0 = findeol();
      ! 	cs = k2;
            }
            return t0;
        }
      --- 246,256 ----
            deal with appropriately.  At this point we just need to make the range
            encompass entire lines. */
            if (zlecmds[k2].flags & ZLE_LINEMOVE) {
      ! 	int newcs = findbol();
        	cs = t0;
        	t0 = findeol();
      ! 	cs = newcs;
      ! 	vilinerange = 1;
            }
            return t0;
        }

 -zefram

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQCVAgUBMXbJwnD/+HJTpU/hAQGg3wP/fbEeWcbtuJW9kb6H9ABYTDs2W5D6DTvS
vWdPnAljtvg6EeAf7cteIbY4ClPbfXnvkSYdLKPFQnrhOUeJLkSXRBuSWaPB478b
Khc+9xKjbOAbXHPxHFLLZZAg2r/uPTw+V+VtHn89qngRleu9cPBhs6IfoTSTap69
x0K4Jpuv59w=
=qdz5
-----END PGP SIGNATURE-----




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