zsh-workers
 help / color / mirror / code / Atom feed
From: Karl Chen <quarl@NOSPAM.quarl.org>
To: zsh-workers@sunsite.dk
Subject: promptcr workaround
Date: Tue, 01 Mar 2005 00:17:43 -0800	[thread overview]
Message-ID: <quack.20050301T0017.874qfvbx08@quack.cs.berkeley.edu> (raw)


I've always been unsatisfied with the answer to FAQ entry
3.23 "How do I prevent the prompt overwriting output when there is
no newline?"  I dislike zsh's promptcr behavior both on and off.
I don't like silently losing the last line nor having a messed-up
prompt, and didn't like adding an extra newline on every command.

Here's a way to simulate adding the \n only when necessary:

    function precmd {
        echo -n ${(l:$COLUMNS:::)}
    }

This prints $COLUMNS spaces.  Iff there's any output on the line
already, it'll wrap to somewhere on the next line.  So when zsh
prints the \r it'll always erase only spaces.


-- 
Karl 2005-03-01 00:10


             reply	other threads:[~2005-03-01  9:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01  8:17 Karl Chen [this message]
2005-03-01 16:41 ` Wayne Davison
2005-03-01 17:06   ` Wayne Davison
2005-03-01 19:50   ` Karl Chen
2005-03-01 17:39 ` Bart Schaefer
2005-03-01 18:20   ` Danek Duvall
2005-03-01 18:50     ` Wayne Davison
2005-03-02 20:21   ` Clint Adams

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=quack.20050301T0017.874qfvbx08@quack.cs.berkeley.edu \
    --to=quarl@nospam.quarl.org \
    --cc=quarl+dated+1110096615.ea06d0@nospam.quarl.org \
    --cc=zsh-workers@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).