From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: PATCH: 3.1.5: Re: New-line in prompt
Date: Mon, 9 Nov 1998 08:42:37 -0800 [thread overview]
Message-ID: <981109084237.ZM17914@candle.brasslantern.com> (raw)
In-Reply-To: <9811091500.AA15026@ibmth.df.unipi.it>
On Nov 9, 4:00pm, Peter Stephenson wrote:
} Subject: PATCH: 3.1.5: Re: New-line in prompt
}
} However, the other bit, adding a newline if the current line is too
} long, is a different kettle of fish. It's possible to add a test flag
} so you can put in arbitrary text if the line has reached a certain
} length. With the patch to 3.1.5 at the end, you can do e.g.
}
} PS1='any old stuff%(30l.
} .)some more stuff'
This is certainly interesting.
My first thought was to approach this problem with truncation behavior,
which turned out to be a lot more painful than I expected. For one
thing, the documentation for $<...< and %>...> don't explain that the
truncation AND the computation of the length of the string apply only to
*one* immediately following prompt component. Once that's understood,
it becomes apparent that the conditional syntax is the only way to group
other prompt components (except for %{...%} which isn't desirable here).
So I end up with something silly like (warning, this doesn't work):
PS1='%78>
%m[%h] >%(0_.%/ %m[%h] .)'
At which point I discover (which perhaps should have been obvious, but
wasn't) that the string inside the %>...> is not itself prompt-expanded;
and further that %>...> "reaches inside" the %(...) construct to only
truncate the %/ in spite of my effort to group it. (Oh, and, BTW, that
there's no way to escape '>' or '<' inside %>...> or %<...<.)
At the very least, this all ought to be documented.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~1998-11-09 16:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.OSF.3.96.981109132554.12190D-100000@alpha2.poco.phy.cam.ac.uk>
1998-11-09 15:00 ` Peter Stephenson
1998-11-09 16:42 ` Bart Schaefer [this message]
1998-11-11 16:06 ` PATCH: 3.1.5: prompt truncation behaviour Peter Stephenson
1998-11-11 21:26 ` Bart Schaefer
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=981109084237.ZM17914@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@math.gatech.edu \
/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).