zsh-workers
 help / color / mirror / code / Atom feed
* Ncurses and shortcuts in tty
@ 2013-03-03 16:15 fulvio marro
  2013-03-03 17:38 ` Frank Terbeck
  2013-03-03 18:18 ` Bart Schaefer
  0 siblings, 2 replies; 3+ messages in thread
From: fulvio marro @ 2013-03-03 16:15 UTC (permalink / raw)
  To: zsh-workers

The following code is supposed to open a ncurses program (ncmpcpp)
using Alt+\ in a tty
ncmpShow(){ ncmpcpp; }
zle -N ncmpShow
bindkey '^[\' ncmpShow
It works, but I can't interact with it.
It is the same if I try with other ncurses programs.
Nethack tells me "You must play nethack from a terminal"
I have put the code in /etc/zsh/zshrc
The analog bash code I have put in /etc/inputrc is
"\e\\":"ncmpcpp\n"
but zsh does not source /etc/inputrc, right?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ncurses and shortcuts in tty
  2013-03-03 16:15 Ncurses and shortcuts in tty fulvio marro
@ 2013-03-03 17:38 ` Frank Terbeck
  2013-03-03 18:18 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Terbeck @ 2013-03-03 17:38 UTC (permalink / raw)
  To: fulvio marro; +Cc: zsh-workers

fulvio marro wrote:
> The following code is supposed to open a ncurses program (ncmpcpp)
> using Alt+\ in a tty
> ncmpShow(){ ncmpcpp; }

ncmpShow() {
  BUFFER="ncmpcpp"
  zle accept-line
}

> zle -N ncmpShow
> bindkey '^[\' ncmpShow
[...]
> but zsh does not source /etc/inputrc, right?

Zsh does not use the readline library. inputrc is a readline facility.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ncurses and shortcuts in tty
  2013-03-03 16:15 Ncurses and shortcuts in tty fulvio marro
  2013-03-03 17:38 ` Frank Terbeck
@ 2013-03-03 18:18 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2013-03-03 18:18 UTC (permalink / raw)
  To: fulvio marro, zsh-workers

On Mar 3,  5:15pm, fulvio marro wrote:
}
} ncmpShow(){ ncmpcpp; }
} zle -N ncmpShow
} bindkey '^[\' ncmpShow
} It works, but I can't interact with it.

To expand a bit on Frank's answer, here you're executing ncmpShow from
inside a ZLE widget, which means ZLE is still "in control" of your
terminal -- it expects the widget to be doing something related to
editing the current command input.

What Frank's widget does instead is load ncmpShow into the ZLE command
buffer and then tell ZLE that command editing is finished (accept-line),
so ZLE relinquishes control and ncmpShow can take over.

If what you're wanting to do is run ncmpShow during the editing of a
different command line and then resume editing the command afterward,
you'll need a different solution.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-03 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-03 16:15 Ncurses and shortcuts in tty fulvio marro
2013-03-03 17:38 ` Frank Terbeck
2013-03-03 18:18 ` Bart Schaefer

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).