zsh-users
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-users@zsh.org
Subject: Re: print to the terminal in zle
Date: Fri, 26 Jul 2013 19:36:46 +0200	[thread overview]
Message-ID: <87siz1gr4h.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <20130726134811.GA14136@chaz.gmail.com> (Stephane Chazelas's message of "Fri, 26 Jul 2013 14:48:11 +0100")

Hey Stephane,

Stephane Chazelas wrote:
> recently, Debian broke some of my scripts using ZLE in `zsh -i` by adding:

An interactive shell for a script? What's the reason for that?

>         function zle-line-init () {
>             emulate -L zsh
>             printf '%s' ${terminfo[smkx]}
>         }
>
> To /etc/zsh/zshrc
>
> That smkx  escape sequence is printed to stdout instead of the terminal.

Which terminal is that? The terminal should definitely react to smkx if
it has that sequence in its terminfo database entry. Are you maybe
changing $TERM to something the terminal cannot handle?

If not, what are you doing that uses zle and is not connected to a
terminal?

> What would be the correct way to do it?

There is also `echoti'. But it barfs if the $TERM for which the terminfo
db query was done doesn't have the key you asked for. But it does
exactly the same as the printf. It outputs the escape sequence to
stdout:

% echoti smkx | cat -v
^[[?1h^[=

> Doing `printf > /dev/tty` would probably do it but it would be
> better I think to be able to write to the fd that zsh currently
> has opened to the terminal (usually 10 if it  was free upon zsh
> startup).
>
> is there a way to do that?

Hm, I don't see how that would be better. Care to elaborate?

> Or an alternative way to set smkx on ZLE init and rmks  on
> zle-finish?

I think smkx/rmkx switching should always be done while the line editor
is active - directly in the zsh/zle module. I think this was discussed,
though, and it was decided to keep it the way it is in order to not
break existing setups.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


  parent reply	other threads:[~2013-07-26 17:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 13:48 Stephane Chazelas
2013-07-26 17:05 ` Peter Stephenson
2013-07-26 17:36 ` Frank Terbeck [this message]
2013-07-27 16:20   ` Stephane Chazelas
2013-07-27 18:58     ` Greg Klanderman
2013-07-26 19:39 ` Peter Stephenson
2013-07-27  0:00   ` Bart Schaefer
2013-07-27 16:30   ` Stephane Chazelas
2013-07-27 17:02     ` Stephane Chazelas

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=87siz1gr4h.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-users@zsh.org \
    /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).