From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Cannot invoke widget within zpty, with \C-a nor a
Date: Tue, 6 Nov 2018 16:19:23 +0100 [thread overview]
Message-ID: <CAKc7PVA5BKywt0GEgJUWcC57bFqC6emwGthZQPe2YmcnA9HFYg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]
Hello,
I've attached complete test file. The test body is:
zpty_start
zpty_input 'stty 38400 columns 80 rows 24 tabs -icanon -iexten' nl
zpty_input 'rh_widget() { BUFFER="ls"; region_highlight+=( 0 4
"fg=#12569a" ); echo yes; }' nl
zpty_input 'zle -N rh_widget' nl
zpty_input 'bindkey "\C-a" rh_widget' nl
zpty_input 'zle -la | grep rh_widget' nl
zpty_input 'bindkey | grep rh_widget' nl
zpty_input $'\C-a'
zpty_stop
0:region_highlight
*>*ls*
The result is always:
Pattern match filead, line mismatch (1/3):
<*ls*
>rh_widget
>"^A" rh_widget
>zsh: command not found: ^A
Note that the 2 middle lines confirm the widget is created and bound to Ctrl-A.
I can change Ctrl-A sequence to just letter "a", and the result is the
same. I've tried also without the first stty command (I was looking
for some needed initialization in Y0* completion tests, that's why
it's there). What can be the cause?
Ctrl-T was invoking TTY "status" command, which on BSD gives system
load. So I've changed to TTY-unused Ctrl-A. I just need to invoke zle
widget so if there is other method (zle -F didn't work) I can use it.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
[-- Attachment #2: D10highlight.txt --]
[-- Type: text/plain, Size: 1372 bytes --]
# Tests for region_highlight, true-color support, near-color support
%prep
if [[ $OSTYPE == cygwin ]]; then
ZTST_unimplemented='the zsh/zpty module does not work on Cygwin'
elif zmodload zsh/zpty 2> /dev/null; then
zpty_start() {
export PS1= PS2=
zpty -d
zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z"
}
zpty_input() {
zpty -w zsh "$1" ${${(M)2:#nl}:+$'\n'}
}
zpty_line() {
local REPLY
integer i
for (( i = 0; i < ${1:-1}; ++i )); do
zpty -r zsh REPLY
print -r -- ${REPLY%%($'\r\n'|$'\n')}
done
}
zpty_stop() {
# exit twice in case of check_jobs
zpty -w zsh $'exit\nexit\n'
# zpty gives no output when piped without these braces (?)
{ zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;'
zpty -d
:
}
else
ZTST_unimplemented='the zsh/zpty module is not available'
fi
%test
zpty_start
zpty_input 'stty 38400 columns 80 rows 24 tabs -icanon -iexten' nl
zpty_input 'rh_widget() { BUFFER="ls"; region_highlight+=( 0 4 "fg=#12569a" ); echo yes; }' nl
zpty_input 'zle -N rh_widget' nl
zpty_input 'bindkey "\C-a" rh_widget' nl
zpty_input 'zle -la | grep rh_widget' nl
zpty_input 'bindkey | grep rh_widget' nl
zpty_input $'\C-a'
zpty_stop
0:region_highlight
*>*ls*
%clean
zmodload -ui zsh/zpty
# vim:ft=zsh
next reply other threads:[~2018-11-06 15:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 15:19 Sebastian Gniazdowski [this message]
2018-11-06 17:08 ` Sebastian Gniazdowski
2018-11-06 17:15 ` Peter Stephenson
2018-11-06 19:53 ` Sebastian Gniazdowski
2018-11-06 19:55 ` Sebastian Gniazdowski
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=CAKc7PVA5BKywt0GEgJUWcC57bFqC6emwGthZQPe2YmcnA9HFYg@mail.gmail.com \
--to=sgniazdowski@gmail.com \
--cc=zsh-workers@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).