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

RE: Predict-on and colored/higlighted predicted text

Bart Schaefer:

Thank you for your feedback. Sorry, I been a bit busy and I haven't been
able to try your suggestions. I'm not sure what to make of that function or
how to use it, actually. But I'll give it a try and get back to you on it.

Thanks again.
 < ^ ; ~,  Clifford Escobar CAOILE  (aka "Piyo-kun")
  (_  _,
   J~~>  _.___...:.__..__.: __.:_. .:_.__::_..:._::._...  _____ p(^_^)q

| -----Original Message-----
| From: Bart Schaefer [mailto:schaefer@xxxxxxxxxxxxxxxx]
| Sent: Sunday, January 26, 2003 11:55
| To: zsh-users@xxxxxxxxxx
| Subject: Re: Predict-on and colored/higlighted predicted text
| I wrote:
| } Unfortunately the zsh line editor does not provide a way to insert
| } into the command line any characters that are not actually part of the
| } command. [...] So without some fairly large changes to ZLE, colorizing
| } parts of the command is not possible.
| I was thinking about this, and it turns out it's not *quite* impossible,
| but it does depend on redrawing behavior; so I'm not sure it will always
| work, and it'd be really unpleasant over a slow connection.
| Here's a small function that shows how to do it.  It highlights from the
| cursor position to the end of the line, but it wouldn't be hard to
| adapt to highlight any given section.
| function hilite {
|   setopt localoptions promptpercent
|   local rbuffer="$RBUFFER"
|   RBUFFER=""				# Truncate the buffer
|   zle -R				# Redraw that much
|   print -nP %U				# Begin highlight
|   RBUFFER="$rbuffer"			# Restore the buffer
|   zle -R				# Redraw the rest
|   print -nP %u				# End highlight
| }
| However, as soon as you begin to edit the line, all bets are off as to
| where the highlight remains (or doesn't).
| __________
| In that same message, I also wrote:
| } ... perhaps try these settings:
| I failed to cut'n'paste one that should have been included, to disable
| menu selection when autocompleting.  If you don't have menu selection
| enabled, you don't need this.
| zstyle ':completion:predict:*' menu yes
| There's probably a more clever setting of that for zsh-4.1.x-dev now
| that menu selection has "interactive mode", but I haven't worked out
| what it is.
| --
| Bart Schaefer                                 Brass Lantern Enterprises
| http://www.well.com/user/barts              http://www.brasslantern.com
| Zsh: http://www.zsh.org | PHPerl Project:

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