From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-users@sunsite.dk
Subject: (Fwd) Re: compctl -y problem.
Date: Fri, 25 May 2001 16:56:40 +0000 [thread overview]
Message-ID: <1010525165640.ZM17988@candle.brasslantern.com> (raw)
Sorry about the duplication to zsh-workers recipients ... I meant to change
the destination address but then clicked Send too quickly.
--- Forwarded mail from <schaefer@candle.brasslantern.com> ("Bart Schaefer")
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
Date: Fri, 25 May 2001 16:35:08 +0000
To: zsh-workers@sunsite.dk
Subject: Re: compctl -y problem.
Cc: Cesar Crusius <crusius@barcelonadesign.com>
(Part of this thread went to zsh-workers ... returning now to zsh-users
with a workaround)
On May 25, 3:11pm, Bart Schaefer wrote:
}
} I know Sven won't be thrilled about being asked to fix anything in the
} old compctl code ... perhaps we should just remove the `-y' option, as
} it's new since 3.0 anyway, and document the correct way to achieve the
} same effect by using the new completion system (which, incidentally, I
} don't know how to do ... `compadd -d' doesn't quite cut it).
On further reading of the compadd doc, `compadd -ld ...' appears to be
the thing to do, though it's a bit convoluted.
autoload -U compinit
compinit
function _aecd {
local change_descriptions reply
# Force change_descriptions to be a one-element array
change_descriptions=("$(aereport changes -unf | grep -v completed)")
# The name "reply" is not special here, I just happened to use it
reply=($(aereport changes -terse | grep -v completed | sed -e 's/ .*$//'))
# Display the change_descriptions in place of the first completion
compadd -ld change_descriptions $reply[1]
# Add the rest of the completions, but don't display them in the list
compadd -na 'reply[2,-1]'
# Force the list to appear so the descriptions are visible
compstate[list]='list force'
}
compdef _aecd aecd
It does appear that "compadd -d" still produces a sub-optimal display in
this case if there are any lines in $change_descriptions that have exactly
$COLUMNS characters; but it properly returns the cursor to the right spot
even so.
I don't know what the output of `aereport changes` looks like, so it may
be that there's a simpler solution. For example, if the same number of
lines will be returned by `aereport changes -unf` and `... -terse`, this
will work:
function _aecd {
local change_descriptions reply
change_descriptions=(${(f)"$(aereport changes -unf | grep -v completed)"})
reply=($(aereport changes -terse | grep -v completed | sed -e 's/ .*$//'))
compadd -ld change_descriptions -a reply
compstate[list]='list force'
}
You may also wish to drop that compstate[list] assignment and instead use
the force-list style to control it:
zstyle ':completion:*:aecd' force-list always
See the manual for more.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
---End of forwarded mail from <schaefer@candle.brasslantern.com> ("Bart Schaefer")
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
reply other threads:[~2001-05-25 16:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1010525165640.ZM17988@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=zsh-users@sunsite.dk \
/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).