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

Re: How to make underlining of a command line disappear after an ordinary key press? (2)



Guido van Steen wrote:
> ordinary-key-press(){
> 	if [[ $KEYS = [[:print:]] ]]; then
> 		region_highlight=("0 0 underline")
> 	fi
> 	zle .self-insert
> }
> 
> zle -N .self-insert ordinary-key-press

You *don't* want the "." in the zle -N.  The whole point of the
dot-commands is that they can't be replaced by user widgets.  That's
the same reason you *do* want it in the function.

  ordinary-key-press(){
  	if [[ $KEYS = [[:print:]] ]]; then
  		region_highlight=("0 0 underline")
  	fi
  	zle .self-insert
  }

  zle -N self-insert ordinary-key-press

There's nothing special about space so long as it's bound to
self-insert; I had no trouble using it.

By the way, if you ever need to undo this, the incantation is

  zle -A .self-insert self-insert

---don't simply delete self-insert or you will have trouble typing.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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