zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: <zsh-users@sunsite.dk>
Subject: Re: Predict-on and colored/higlighted predicted text
Date: Sun, 26 Jan 2003 02:55:09 +0000	[thread overview]
Message-ID: <1030126025509.ZM16716@candle.brasslantern.com> (raw)
In-Reply-To: <1030125205736.ZM16226@candle.brasslantern.com>

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: http://phperl.sourceforge.net   


  reply	other threads:[~2003-01-26  2:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-25 16:43 Clifford Caoile
2003-01-25 20:57 ` Bart Schaefer
2003-01-26  2:55   ` Bart Schaefer [this message]
2003-01-28 12:34     ` Clifford Caoile
2003-01-29  6:44     ` Felix Rosencrantz

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=1030126025509.ZM16716@candle.brasslantern.com \
    --to=schaefer@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).