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

Re: zle -R does it support color?



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>
To: zsh-users@xxxxxxx
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
the results?



      


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