From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15369 invoked by alias); 26 Jul 2013 17:50:55 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17892 Received: (qmail 2182 invoked from network); 26 Jul 2013 17:50:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh-users@zsh.org Subject: Re: print to the terminal in zle In-Reply-To: <20130726134811.GA14136@chaz.gmail.com> (Stephane Chazelas's message of "Fri, 26 Jul 2013 14:48:11 +0100") References: <20130726134811.GA14136@chaz.gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Date: Fri, 26 Jul 2013 19:36:46 +0200 Message-ID: <87siz1gr4h.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain X-Df-Sender: [pbs]NDMwNDQ0 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