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: Sat, 25 Jan 2003 20:57:36 +0000	[thread overview]
Message-ID: <1030125205736.ZM16226@candle.brasslantern.com> (raw)
In-Reply-To: <BBEKIEKOHGEFJBFLEENGOEDOCGAA.piyokun@email.com>

On Jan 26,  1:43am, Clifford Caoile wrote:
}
} I have been exploring the 4.0.x functionality called "predict-on" and
} "predict-off". It has been both a gee-wiz and a oh-darn experience

Yes, that was pretty much my experience, even while writing it.  If you
haven't looked at the styles related to predictive typing, I suggest you
do so ("man zshcontrib"), and perhaps try these settings:

zstyle :predict verbose yes
zstyle :predict cursor key
zstyle ':completion:predict:*' completer \
	_oldlist _complete _ignored _history _prefix

I was going to suggest using the "toggle" style as well, but you'd better
apply the appended patch first or you'll be saying "oh darn" even more.

zstyle :predict toggle yes

} Also it reminds me of recent capabilities found in Windows such
} as auto complete in Internet Explorer and Visual Studio 6.

That was the intention.  If you want a different style of auto completion,
have a look at incremental-complete-word.

} I was wondering how far this prediction can be graphically enhanced?

Not very far, I'm afraid.

} Would it be possible to color code or highlight or underscore the part
} of the line that is filled in by prediction?

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.
On a text terminal, the way highlighting/underscoring/etc. is done is by
sending "invisible" characters to the terminal that cause it to change
the appearance of whatever follows.  So without some fairly large changes
to ZLE, colorizing parts of the command is not possible.

However, it's always the case that everything to the right of the cursor
is the part filled in by prediction, so there is that much of a cue.

With some of the recent enchancements to history search in zsh-4.1.x-dev,
it might be possible to have a single keystroke search multiple times and
generate a listing of all the possible hits (a bit like the droplist that
appears below the Address: bar when auto-completing in IE).  I'm not sure
how usable that would be in practice, though.

Here's the patch I mentioned:

Index: Functions/Zle/predict-on
===================================================================
--- predict-on	9 Apr 2001 20:14:12 -0000	1.1.1.1
+++ predict-on	25 Jan 2003 20:18:23 -0000
@@ -55,7 +55,8 @@
     ((++CURSOR))
   else
     LBUFFER="$LBUFFER$KEYS"
-    if [[ $LASTWIDGET == (self-insert|magic-space|backward-delete-char) ]]
+    if [[ $LASTWIDGET == (self-insert|magic-space|backward-delete-char) ||
+	  $LASTWIDGET == (complete-word|accept-*|predict-*) ]]
     then
       if ! zle .history-beginning-search-backward
       then

-- 
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-25 20:58 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 [this message]
2003-01-26  2:55   ` Bart Schaefer
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=1030125205736.ZM16226@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).