zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: A different approach to PROMPT_CR
Date: Sat, 26 Aug 2000 21:46:51 +0100 (BST)	[thread overview]
Message-ID: <E13Smqp-0004ua-00@crucigera.fysh.org> (raw)
In-Reply-To: <1000826175034.ZM13455@candle.brasslantern.com> from Bart Schaefer at "Aug 26, 2000 05:50:34 pm"

Bart Schaefer wrote:
>When promptnl runs, it asks the terminal to send back the current position
>of the cursor.  If the cursor is in column 1, it does nothing; otherwise it
>prints a newline.  Thus you get a newline exactly when one is needed.

This will eat any typeahead.  Actually, if an "R" is typed ahead it'll
get confused.  (Just pointing this out for discussion below.)

>for example use EOLMARK='%B!%b' to put a bold exclamation point at the end
>of the actual output.

This is neat, and solves one of my basic objections to shells outputting
a newline before the prompt (that it hides any missing-final-newline
bugs in programs that you run -- it's a bit of a feature of MS-DOS that
programs do that).

>This could be coded in C and added to ZLE ... `setopt PROMPT_NL', anyone?

Hmm.

There are two issues with doing it in the C code.  One is the matter
of putting terminal-specific features into the base shell.  This is
handleable: with PROMPT_NL set, we'd do this differently depending
on TERM.  With vt100-compatible terminals we'd do it the way your shell
function does, with other terminals we'd use different escape sequences,
and with unknown terminals we'd do nothing.

The other issue is the typeahead problem noted above.  Integrating this
into ZLE could mostly solve that.  Firstly, we can refuse to attempt
anything if we detect typeahead.  Then, for terminal types that return
the cursor position in a recognisable form, if what we get isn't in
the expected form we can abandon the attempt and use what we read as
normal input.  It'd still sometimes go wrong, particularly over slow
links, but of course it's easy to turn off.

-zefram


       reply	other threads:[~2000-08-26 20:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1000826175034.ZM13455@candle.brasslantern.com>
2000-08-26 20:46 ` Zefram [this message]
2000-08-26 22:27   ` Bart Schaefer
2000-08-28 20:47     ` Peter Stephenson

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=E13Smqp-0004ua-00@crucigera.fysh.org \
    --to=zefram@fysh.org \
    --cc=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@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).