zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-users@sunsite.auc.dk
Cc: Jerry Peek <jpeek@jpeek.com>
Subject: Re: zsh tips for "UNIX Power Tools"
Date: Sat, 4 Mar 2000 18:12:43 +0000	[thread overview]
Message-ID: <1000304181244.ZM24879@candle.brasslantern.com> (raw)
In-Reply-To: <20000304132224.B12751@vin.ens-lyon.fr>

On Mar 4,  1:22pm, Vincent Lefevre wrote:
} Subject: Re: zsh tips for "UNIX Power Tools"
}
} We can have a prompt on the left (the normal prompt), a part of
} the prompt on the right, but can we have one below, that won't
} be corrupted by the completions?

What does "corrupted by completions" mean?  Covered up by a listing?

Having a prompt below the normal prompt is very tricky, because the
output of any command that you run will begin on the same line where
the "below" part of the prompt is.  And of course if you edit a long
line or a multiline buffer, the line editor needs to use that line, so
there's really no way for zsh to "reserve" it.

Here's a trick (usable only in 3.1.6-dev-19 or thereabouts, and later)
that you may find interesting:

self-insert() {
    zle .self-insert
    [[ -o always_last_prompt ]] && zle -R '' "Line: $((${#LBUFFER//[^
]}+1)) / Column: ${#LBUFFER##*
}" || return 0
}
zle -N self-insert

(Yes, those embedded newlines really should be there.)

This uses the completion listing to keep a running display of the line
and column at which you most recently inserted a character.  ZLE knows
how big a buffer it's editing, so it always places this output below
the entire editable text.

Of course this erases any existing completion listing every time you
insert a character (though not every time you complete), but maybe you
can live with that.

Overriding the many other ZLE widgets to make motions, deletions, etc.
also update the line and column is left as an excercise for the reader.
Beware of other packages like `predict-on' (included with 3.1.6-dev-19)
that also may attempt to redefine bindings in incompatible ways.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~2000-03-04 18:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-02 16:13 Jerry Peek
2000-03-03 11:39 ` Thomas Köhler
2000-03-03 14:17   ` Jerry Peek
2000-03-03 23:05   ` Bruce Stephens
2000-03-04  5:40     ` Bart Schaefer
2000-03-04 12:05       ` Thomas Köhler
2000-03-04 16:38         ` Bart Schaefer
2000-03-04 17:18           ` Bart Schaefer
2000-03-04 12:31       ` Bruce Stephens
2000-03-04 11:43     ` Thomas Köhler
2000-03-04 12:43       ` Bruce Stephens
2000-03-04 12:22     ` Vincent Lefevre
2000-03-04 18:12       ` Bart Schaefer [this message]
2000-03-05 23:19         ` Vincent Lefevre
2000-03-06  0:30           ` Bart Schaefer
2000-03-06 20:51           ` Thomas Köhler

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=1000304181244.ZM24879@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=jpeek@jpeek.com \
    --cc=zsh-users@sunsite.auc.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).