zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Peter Stephenson <pws@csr.com>,
	zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Re: PATCH: Polite output from traps with zle active
Date: Thu, 2 Nov 2000 17:30:42 +0000	[thread overview]
Message-ID: <1001102173042.ZM19733@candle.brasslantern.com> (raw)
In-Reply-To: <0G3E0018CA6WEG@la-la.cambridgesiliconradio.com>

On Nov 2, 11:20am, Peter Stephenson wrote:
} Subject: PATCH: Polite output from traps with zle active
}
} TRAPUSR1() {
}   zle -I
}   print Hello, I am output
}   zle -R
} }
} 
} It's possible there are extra safeguards I should have added but missed.
} If anyone thinks this should be done a different way, now would be a good
} time to mention it.

It's too bad that the trap writer has to call `zle -R' as well as `zle -I'.
What happens if you accidentally call only `zle -I'?

I can see how the zsh trap handler can't possibly know in advance whether
the user-defined trap will produce output, and therefore shouldn't do a
trashzle() on its own -- but surely it could detect whether zle has been
trashed and do the zrefresh() automatically?

If there really is some valid use for trashing zle without refreshing it,
perhaps another parameter to `zle -I' (or even something like `zle +I')
could be used to suppress the eventual zrefresh().

} It alters zle -R to allow it to be called when zle is not active ---
} it simply returns zero --- and adds `zle -I' (invalidate), which
} simply calls trashzle(). Both are allowed when zle is not active (and
} do nothing) because there is no good reason for forcing the onus of
} deciding whether the display needs to be cleared and refreshed onto
} the writer of the trap function.

It'd also be nice if `zle -R' and `zle -I' returned zero when zle is
active and nonzero otherwise, just as `zle' with no arguments does.
There may not be much use for this, since probably one most often wants
to test for zle *before* invalidating it, but there is some benefit to
consistency.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2000-11-02 17:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-02 11:20 Peter Stephenson
2000-11-02 17:30 ` Bart Schaefer [this message]
2000-11-03 11:09   ` 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=1001102173042.ZM19733@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=pws@csr.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).