From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19902 invoked from network); 5 Jan 1997 15:44:12 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 5 Jan 1997 15:44:12 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id KAA14523; Sun, 5 Jan 1997 10:49:10 -0500 (EST) Resent-Date: Sun, 5 Jan 1997 10:49:10 -0500 (EST) From: Zefram Message-Id: <4164.199701051550@stone.dcs.warwick.ac.uk> Subject: history-search-*ward To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Sun, 5 Jan 1997 15:50:21 +0000 (GMT) X-Patch: 185 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8683.29 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"2Az7J1.0.sY3.srypo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2730 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----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-----