Zsh Mailing List Archive
Messages sorted by:
Re: zle -R does it support color?
- X-seq: zsh-users 15779
- From: Wendell Hom <wendell_hom@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: zle -R does it support color?
- Date: Tue, 8 Feb 2011 22:15:14 -0800 (PST)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1297232115; bh=eM0Qn3uHoWlMB4TCtsSNo0bV9VcVOVpS3VUP3lIK5fQ=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=iilC6AlpT6fbLShSoz56IMeYCLF3u1yi95lB4sMefakHW+YCTwx0Zg6BtRqovz5Mcf78IeKOl8YA4QPgW2MMnIZ9uAxyIhFlElm00XQwAA61KBFzokOg4gv2ywYI+tdkuyVXlMmbQ6GwaIpC8vniZdTGD+FyKEYjomAfEK4lnYA=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=nHfAsnrqoeZAFcI4qY11zce7UMyk+e6crvqS6JhREA7fHZRQp0w9QKozjOU4vPjo0HbXIvBeYAjrqg4PCepl6BxmFyOWFg/NGk8ZYzS38vBskTG4/6yXIHWKeNU/E4PDdHUDpQkyJ1QV8It2KuEumpW70JoVrTWQv9ti5tBXabU=;
- In-reply-to: <110208212527.ZM24140@torch.brasslantern.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <email@example.com> <110208212527.ZM24140@torch.brasslantern.com>
The way my "completion" widget works is that when it is invoked, it enters a
loop and waits for the next key to be pressed.
Every time a key is pressed, the new completion list is redisplayed
automatically. Some commonly used keys like the Enter key, semicolon, quotes,
etc., are also mapped to perform different functions that help move around
directories and choosing files. Once control returns from the widget, the
normal key bindings are back. It basically cuts down on typing and speeds
things up for me.
I resorted to simulating the completion using zle -R because I wasn't able to
get the completion widget to do what I wanted. I wanted to be able to stay
within the widget so that the keys perform different functions. I suppose that
can be accomplished instead by binding a key to change key mappings, but I also
wanted the completion list to change automatically without having to hit the Tab
key each time once I enter this mode. Or if I can find a way to redisplay the
completion list w/o returning from the widget, then that should work but I am
not sure if that is possible.
From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
Sent: Tue, February 8, 2011 9:25:27 PM
Subject: Re: zle -R does it support color?
On Feb 8, 4:29pm, Wendell Hom wrote:
} I am using zle -R to list the file/directory choices that match a
} string in the buffer. The script serves its purpose, but I can't seem
} to get any color output using zle -R; it displays control characters
} instead. Does zle -R support color output?
No, zle -R doesn't support any sort of terminal control. ZLE is pretty
restrictive of what it will let you do outside of a prompt string, in
order that it be able to keep track of what the screen (well, the bit
of the screen that it last scribbled on) looks like at all times.
It doesn't "know" which escape sequences require zero display space,
which ones move the cursor around, etc., so it won't emit any of them.
You might be able to do something with POSTDISPLAY and region_highlight
but it'd require a fair amount of work.
} It would be nice to have a color-coded output so I can easily spot
} directories vs. filenames vs symlinks, etc.
Out of curiosity, why are you simulating a completion with zle -R
rather than doing a real completion list and allowing that to color
Messages sorted by: