zsh-workers
 help / color / mirror / code / Atom feed
From: P.Stephenson@swansea.ac.uk
To: Jeff Blank <jfblank@mtu.edu>
Cc: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: 2.6b13 history question
Date: Mon, 19 Feb 96 09:12:09 +0000	[thread overview]
Message-ID: <7271.9602190912@pyro.swan.ac.uk> (raw)
In-Reply-To: "jfblank@mtu.edu"'s message of "Sat, 17 Feb 96 17:35:37 EST."             <199602172235.RAA09677@bullwinkle.tc.mtu.edu>

jfblank@mtu.edu wrote:

> there are some differences in the way history is handled...for example,
> ls  -l ChangeLog
> ls -l  ChangeLog
> ls -l ChangeLog 
>                ^space
> ls -l ChangeLog
>                ^no space
> (etc...) all show up as separate history entries due to varying amounts of
> space (even with histingoredups set).

This is deliberate --- or at least known.  The shell now always stores the
line literally, instead of a pruned-down version with words separated
by a special token.  I didn't think it worth adding any code to change
this, since if you're repeating the last line I supposed you wouldn't
need to change the spaces.

If this seems important, the comparison can be changed to ignore
space.  This will do it, though perhaps someone else can think of a
less verbose way.


*** hist.c.ign	Mon Jan 15 17:10:25 1996
--- hist.c	Mon Feb 19 10:06:59 1996
***************
*** 537,542 ****
--- 537,570 ----
	histremmed = 1;
  }
  
+ /* compare line, ignoring multiple white space for HIST_IGNORE_DUPS */
+ 
+ /**/
+ int
+ strspacecmp(char *s1, char *s2)
+ {
+   /* ignore initial blanks */
+   int blankflag = 1;
+ 
+   for (; *s1 && *s2; s1++, s2++)
+     if ((iblank(*s1) && iblank(*s2)) || blankflag) {
+       while (iblank(*s1))
+	s1++;
+       while (iblank(*s2))
+	s2++;
+       blankflag--;
+     } else if (*s1 != *s2)
+       return (int)*s2 - (int)*s1;
+ 
+   /* ignore trailing blanks when one string has already terminated */
+   while (iblank(*s1))
+     s1++;
+   while (iblank(*s2))
+     s2++;
+ 
+   return (int)*s2 - (int)*s1;
+ }
+ 
  /* say we're done using the history mechanism */
  
  /**/
***************
*** 567,573 ****
		save = 0;
	he = gethistent(curhist - 1);
	if (!*chline || !strcmp(chline, "\n") ||
!	    (isset(HISTIGNOREDUPS) && he->text && !strcmp(he->text, chline)) ||
	    (isset(HISTIGNORESPACE) && spaceflag))
	    save = 0;
      }
--- 595,602 ----
		save = 0;
	he = gethistent(curhist - 1);
	if (!*chline || !strcmp(chline, "\n") ||
!	    (isset(HISTIGNOREDUPS) && he->text &&
!	     !strspacecmp(he->text, chline)) ||
	    (isset(HISTIGNORESPACE) && spaceflag))
	    save = 0;
      }

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


  reply	other threads:[~1996-02-19  9:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-17 22:35 Jeff Blank
1996-02-19  9:12 ` P.Stephenson [this message]
1996-02-19 17:57   ` Zefram
1996-02-20 19:41   ` Wayne Davison
1996-02-21  8:34     ` Bas V. de Bakker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7271.9602190912@pyro.swan.ac.uk \
    --to=p.stephenson@swansea.ac.uk \
    --cc=jfblank@mtu.edu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).