zsh-workers
 help / color / mirror / code / Atom feed
* Three Bugs/Problems and a Requested Feature
@ 1995-07-26  1:38 Andy Wick
  1995-07-26 12:41 ` Zefram
  1995-07-30 21:49 ` Zoltan Hidvegi
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Wick @ 1995-07-26  1:38 UTC (permalink / raw)
  To: zsh-workers

These 3 bugs show up in beta 10, hzoli 10.1, hzoli 10.1 with some recent patches

OPTIONS: autocd correctall cshjunkieloops hashcmds hashdirs hashlistall
interactive login mailwarning menucomplete monitor nolistbeep notify
pathdirs shinstdin zle

1.  Auto correct bug (Most important to me :)

> mkdir /tmp/mpt
> mpt=/tmp/mpt
> cd ~mpt  # This works
> ~mpt 
OUTPUT: beta 10 and hzoli 10.1
   zsh: correct '~mpt' to 'mt' [nyae]

OUTPUT: hzoli 10.1 with patches
   zsh: correct '

Obviously it should just cd into the directory, and does this with most
of my named directories.  But not with ones that "can" be corrected to
something else.

2. WATCHFMT doesn't seem to support Bold anymore!  Stopped working
   with beta9 or beta10 I believe, hzoli inherited the problem.

 "That %B%n%b has %a (%l)..." 

3. named directories sometimes don't show the shortest path.  Happens
   randomly.

> maps=/tmp/maps
> mpt1=~maps/mpt1
> mpt2=~mpt1/mpt2
> mpt3=~mpt2/mpt3
> cd ~mpt3

OUTPUT of "%~" will show different things.  ie
   >  ~mpt3   # Correct
   >  ~maps/mpt1/mpt2/mpt3   # Not the shortest one
   >  ~mpt2/mpt3   # Not the shortest one

I have many many named directories if that matters.


WANTED FEATURE!!!!!

At the autocorrect prompted I have always "dreamed" of being able to
hit "c" for change.  Which would put me in "change mode" for the
word that needs to be fixed.  Kind of like "cw" in vi.  So say
I had "tcat thisisahzolifilethathasareallylongname.tar.gz | tar xf -

Currently it might try to correct that "tcat" to "cat" instead of 
"zcat".  So I would need to do a "e" for edit, and then arrow over or
hit "ESC0ecw". It would be nice to be able to hit 'c' have it do basicly
a vi-ish "cw" on the word "tcat", since it already knew thats what needed
to be corrected. Don't know if this makes any sense, if it is really hard,
but I would use it all the time.
   
   Thanks
-- 
awick@vt.edu                                        Andy Wick
awick@yertle.fp.trw.com                         Virginia Tech/TRW
It may be that your whole purpose in life, is to serve as a warning to others.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Three Bugs/Problems and a Requested Feature
  1995-07-26  1:38 Three Bugs/Problems and a Requested Feature Andy Wick
@ 1995-07-26 12:41 ` Zefram
  1995-07-30 21:49 ` Zoltan Hidvegi
  1 sibling, 0 replies; 3+ messages in thread
From: Zefram @ 1995-07-26 12:41 UTC (permalink / raw)
  To: Z Shell workers mailing list

>3. named directories sometimes don't show the shortest path.  Happens
>   randomly.
>
>> maps=/tmp/maps
>> mpt1=~maps/mpt1
>> mpt2=~mpt1/mpt2
>> mpt3=~mpt2/mpt3
>> cd ~mpt3
>
>OUTPUT of "%~" will show different things.  ie
>   >  ~mpt3   # Correct
>   >  ~maps/mpt1/mpt2/mpt3   # Not the shortest one
>   >  ~mpt2/mpt3   # Not the shortest one
>
>I have many many named directories if that matters.

It works for me.  However, if you do

% maps=/tmp/maps
% mpt1=~maps/mpt1
% mpt2=~mpt1/mpt2
% mpt3=~mpt2/mpt3
% cd /tmp/maps/mpt1/mpt2/mpt3

then %~ will give ~mpt2/mpt3.  If you do

% maps=/tmp/maps
% mpt1=~maps/mpt1
% mpt2=~maps/mpt1/mpt2
% mpt3=~maps/mpt1/mpt2/mpt3
% cd /tmp/maps/mpt1/mpt2/mpt3

then %~ will give ~maps/mpt1/mpt2/mpt3.  Remember that a parameter is
only used for %~ if it has already been used in a ~ expansion.  Could
this be the problem?  If so, the AUTO_NAME_DIRS option may solve it.

>WANTED FEATURE!!!!!
>
>At the autocorrect prompted I have always "dreamed" of being able to
>hit "c" for change.  Which would put me in "change mode" for the
>word that needs to be fixed.  Kind of like "cw" in vi.  So say
>I had "tcat thisisahzolifilethathasareallylongname.tar.gz | tar xf -
>
>Currently it might try to correct that "tcat" to "cat" instead of 
>"zcat".  So I would need to do a "e" for edit, and then arrow over or
>hit "ESC0ecw". It would be nice to be able to hit 'c' have it do basicly
>a vi-ish "cw" on the word "tcat", since it already knew thats what needed
>to be corrected. Don't know if this makes any sense, if it is really hard,
>but I would use it all the time.

Seems reasonable.  It wouldn't fit in with the correction mechanism
very well, but it's possible with a bit of rearrangement.

-zefram


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Three Bugs/Problems and a Requested Feature
  1995-07-26  1:38 Three Bugs/Problems and a Requested Feature Andy Wick
  1995-07-26 12:41 ` Zefram
@ 1995-07-30 21:49 ` Zoltan Hidvegi
  1 sibling, 0 replies; 3+ messages in thread
From: Zoltan Hidvegi @ 1995-07-30 21:49 UTC (permalink / raw)
  To: Andy Wick

Andy Wick wrote:
> 
> These 3 bugs show up in beta 10, hzoli 10.1, hzoli 10.1 with some recent patches
> 
> OPTIONS: autocd correctall cshjunkieloops hashcmds hashdirs hashlistall
> interactive login mailwarning menucomplete monitor nolistbeep notify
> pathdirs shinstdin zle
> 
> 1.  Auto correct bug (Most important to me :)
> 
> > mkdir /tmp/mpt
> > mpt=/tmp/mpt
> > cd ~mpt  # This works
> > ~mpt 
> OUTPUT: beta 10 and hzoli 10.1
>    zsh: correct '~mpt' to 'mt' [nyae]
> 
> OUTPUT: hzoli 10.1 with patches
>    zsh: correct '
> 
> Obviously it should just cd into the directory, and does this with most
> of my named directories.  But not with ones that "can" be corrected to
> something else.

The patch below fixes this. It is only a quick fix: zsh will not try to
correct the word after a tilde (but it still corrects filenames beginning
with tilde, like ~/foo). It also handles equals substitution after this
patch, and tries to correct the name after the =. The one line patch to
zle_misc.c fixes the spelling prompt which broke after Zefram's prompt
patches in art. 265 (as Andy illustrates above). I think that Zefram forgot
to negate a condition here (am I right Zefram?).

Bye,
  Zoltan

*** 1.14	1995/07/24 11:19:03
--- Src/utils.c	1995/07/30 19:13:12
***************
*** 1085,1091 ****
      char *t, *u;
      char firstchar;
      int x;
!     int pram = 0;
  
      if (**s == '-' || **s == '%')
  	return;
--- 1085,1091 ----
      char *t, *u;
      char firstchar;
      int x;
!     char pref = '\0';
  
      if (**s == '-' || **s == '%')
  	return;
***************
*** 1112,1121 ****
      for (t = *s; *t; t++)
  	if (*t == '/')
  	    break;
      if (**s == String) {
  	if (*t)
  	    return;
! 	pram = 1;
  	guess = *s + 1;
  	while (*guess == '+' || *guess == '^' ||
  	       *guess == '#' || *guess == '~' ||
--- 1112,1123 ----
      for (t = *s; *t; t++)
  	if (*t == '/')
  	    break;
+     if (**s == Tilde && !*t)
+ 	return;
      if (**s == String) {
  	if (*t)
  	    return;
! 	pref = String;
  	guess = *s + 1;
  	while (*guess == '+' || *guess == '^' ||
  	       *guess == '#' || *guess == '~' ||
***************
*** 1123,1128 ****
--- 1125,1139 ----
  	    guess++;
  	d = 100;
  	scanhashtable(paramtab, spscan);
+     } else if (**s == Equals) {
+ 	if (*t)
+ 	    return;
+ 	if (hashcmd(guess = *s + 1, pathchecked))
+ 	    return;
+ 	d = 100;
+ 	pref = Equals;
+ 	scanhashtable(aliastab, spscan);
+ 	scanhashtable(cmdnamtab, spscan);
      } else {
  	if ((u = spname(guess = *s)) != *s)
  	    best = u;
***************
*** 1163,1174 ****
  	} else
  	    x = 'y';
  	if (x == 'y' || x == ' ') {
! 	    if (!pram) {
  		*s = dupstring(best);
  	    } else {
  		*s = (char *) alloc(strlen(best) + 2);
  		strcpy(*s + 1, best);
! 		**s = String;
  	    }
  	    if (s2) {
  		if (*tptr && !strcmp(hlastw, *s2) && hlastw < hptr) {
--- 1174,1185 ----
  	} else
  	    x = 'y';
  	if (x == 'y' || x == ' ') {
! 	    if (!pref) {
  		*s = dupstring(best);
  	    } else {
  		*s = (char *) alloc(strlen(best) + 2);
  		strcpy(*s + 1, best);
! 		**s = pref;
  	    }
  	    if (s2) {
  		if (*tptr && !strcmp(hlastw, *s2) && hlastw < hptr) {
***************
*** 1176,1183 ****
  
  		    hptr = hlastw;
  		    qbang = 1;
! 		    if (pram)
! 			hwaddc('$');
  		    for (z = best; *z; z++)
  			hwaddc(*z);
  		    hwaddc(HISTSPACE);
--- 1187,1194 ----
  
  		    hptr = hlastw;
  		    qbang = 1;
! 		    if (pref)
! 			hwaddc(ztokens[pref - Pound]);
  		    for (z = best; *z; z++)
  			hwaddc(*z);
  		    hwaddc(HISTSPACE);
*** 1.13	1995/07/24 17:57:08
--- Src/zle_misc.c	1995/07/29 11:57:46
***************
*** 802,808 ****
      bracepos = -1;
      fm = fmin;
      lensb = 0;
!     pmpt = (dontcount = !cnt) ? fm : NULL;
      bp = bl0 = buf = zalloc(bufspc = 256);
      bp1 = NULL;
  
--- 802,808 ----
      bracepos = -1;
      fm = fmin;
      lensb = 0;
!     pmpt = (dontcount = !cnt) ? NULL : fm;
      bp = bl0 = buf = zalloc(bufspc = 256);
      bp1 = NULL;
  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-07-31 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-07-26  1:38 Three Bugs/Problems and a Requested Feature Andy Wick
1995-07-26 12:41 ` Zefram
1995-07-30 21:49 ` Zoltan Hidvegi

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).