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

PATCH: jobs completion, and Re: _subscript



Firstly, sorry about the problems with my patches wrapping: I'll blame
Microsoft because I was using MS Exchange from work because messages
sent from my main account had been taking a week to get to zsh-workers.
I'm using a different SMTP server for this message so hopefully it'll
work.

Is there a good reason for only completing the first word of jobs (with
compctl -j), i.e. just the name of the command? I find this quite
annoying because most of the jobs I suspend are either less or man so I
have several jobs all with the same command name. This means I end up
having to run jobs and then use the job number with fg.

>From the source, this behaviour seems to have been intentional on the
part of whoever wrote it but it is one of the few remaining areas where
I miss the tcsh behaviour. The simple patch at the end of this mail
fixes it to use the full command.

It isn't a major problem but I should just point out one thing relating
to _subscript: it doesn't deal properly with arrays with missing
elements - try:
anarray=( 1 2 3 )
anarray[5]=Five
echo $anarray[<tab>

In the original patch which I made, I made some attempt to deal with
this (the list was right but the matches weren't).

Finally, I'd just like to add that I think Peter's idea for one
parameter expansion flag for print style options is a good one. 

Oliver Kiddle

*** Src/Zle/zle_tricky.c.old	Sun Jun 20 14:32:34 1999
--- Src/Zle/zle_tricky.c	Mon Jun 21 16:01:34 1999
***************
*** 6365,6371 ****
      if (cc->mask & (CC_JOBS | CC_RUNNING | CC_STOPPED)) {
  	/* Get job names. */
  	int i;
! 	char *j, *jj;
  
  	for (i = 0; i < MAXJOB; i++)
  	    if ((jobtab[i].stat & STAT_INUSE) &&
--- 6365,6371 ----
      if (cc->mask & (CC_JOBS | CC_RUNNING | CC_STOPPED)) {
  	/* Get job names. */
  	int i;
! 	char *j;
  
  	for (i = 0; i < MAXJOB; i++)
  	    if ((jobtab[i].stat & STAT_INUSE) &&
***************
*** 6372,6384 ****
  		jobtab[i].procs && jobtab[i].procs->text) {
  		int stopped = jobtab[i].stat & STAT_STOPPED;
  
! 		j = jj = dupstring(jobtab[i].procs->text);
! 		/* Find the first word. */
! 		for (; *jj; jj++)
! 		    if (*jj == ' ') {
! 			*jj = '\0';
! 			break;
! 		    }
  		if ((cc->mask & CC_JOBS) ||
  		    (stopped && (cc->mask & CC_STOPPED)) ||
  		    (!stopped && (cc->mask & CC_RUNNING)))
--- 6372,6378 ----
  		jobtab[i].procs && jobtab[i].procs->text) {
  		int stopped = jobtab[i].stat & STAT_STOPPED;
  
! 		j = dupstring(jobtab[i].procs->text);
  		if ((cc->mask & CC_JOBS) ||
  		    (stopped && (cc->mask & CC_STOPPED)) ||
  		    (!stopped && (cc->mask & CC_RUNNING)))



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