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

history-search-*ward



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

This patch makes history-search-{for,back}ward behave more like the
documentation says.  They search for lines starting with the same
complete word that the current line does, regardless of whether that
word is the complete line or not.  (The old undocumented type of search
can be obtained by using history-beginning-search-*ward.)  The existing
heuristics that reject target lines containing nothing other than the
word searched for are retained.

This patch must be applied on top of patch 2721, in place of patch 2724.

 -zefram

      *** Src/Zle/zle_hist.c	1997/01/04 17:47:26	1.6
      --- Src/Zle/zle_hist.c	1997/01/05 10:16:46
      ***************
      *** 344,356 ****
        void
        historysearchbackward(void)
        {
      !     int histpos, ohistline = histline;
            char *s;
        
            remember_edits();
      !     for (histpos = 0; histpos < ll && !iblank(line[histpos]); histpos++);
      !     if (histpos < ll)
      ! 	histpos++;
            for (;;) {
        	histline--;
        	if (!(s = zle_get_event(histline))) {
      --- 344,357 ----
        void
        historysearchbackward(void)
        {
      !     int histpos, histmpos, ohistline = histline;
            char *s;
        
            remember_edits();
      !     for (histpos = histmpos = 0; histpos < ll && !iblank(line[histpos]);
      ! 	histpos++, histmpos++)
      ! 	if(imeta(line[histpos]))
      ! 	    histmpos++;
            for (;;) {
        	histline--;
        	if (!(s = zle_get_event(histline))) {
      ***************
      *** 359,364 ****
      --- 360,366 ----
        	    return;
        	}
        	if (metadiffer(s, (char *) line, histpos) < 0 &&
      + 	    iblank(s[histmpos] == Meta ? s[histmpos+1]^32 : s[histmpos]) &&
        	    metadiffer(s, (char *) line, ll))
        	    break;
            }
      ***************
      *** 369,381 ****
        void
        historysearchforward(void)
        {
      !     int histpos, ohistline = histline;
            char *s;
        
            remember_edits();
      !     for (histpos = 0; histpos < ll && !iblank(line[histpos]); histpos++);
      !     if (histpos < ll)
      ! 	histpos++;
            for (;;) {
        	histline++;
        	if (!(s = zle_get_event(histline))) {
      --- 371,384 ----
        void
        historysearchforward(void)
        {
      !     int histpos, histmpos, ohistline = histline;
            char *s;
        
            remember_edits();
      !     for (histpos = histmpos = 0; histpos < ll && !iblank(line[histpos]);
      ! 	histpos++, histmpos++)
      ! 	if(imeta(line[histpos]))
      ! 	    histmpos++;
            for (;;) {
        	histline++;
        	if (!(s = zle_get_event(histline))) {
      ***************
      *** 384,389 ****
      --- 387,394 ----
        	    return;
        	}
        	if (metadiffer(s, (char *) line, histpos) < (histline == curhist) &&
      + 	    (!s[histmpos] ||
      + 	     iblank(s[histmpos] == Meta ? s[histmpos+1]^32 : s[histmpos])) &&
        	    metadiffer(s, (char *) line, ll))
        	    break;
            }

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

iQCVAwUBMs+DPXD/+HJTpU/hAQHdxAQAkCX1cq89MwzhT1zPw6C5UC01CYtWZYYg
WqzaIIpSlmvM8ZfJlC9JWlK3oG35toElNiEujiHc5wK5vR90JnR3mSFzH0G1lM7O
W1MgPuqMHlVmNuwpnmzDl3d/BW1l7NI7LBPLvHW5O9zkRiR4Xy+OPh/gVqcLbkxg
GzccyzICq+A=
=wyKQ
-----END PGP SIGNATURE-----



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