Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Cannot invoke widget within zpty, with \C-a nor a
- X-seq: zsh-workers 43772
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Cannot invoke widget within zpty, with \C-a nor a
- Date: Tue, 6 Nov 2018 16:19:23 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=GoOVQVZJ9mHDDQEpI+/NwZ4U23TCspdtRLgojp6hZeo=; b=oNHkP/RQp0ueXu8JiifPqPaKWaJMuLdQXcl5zQKTVxolh+OibdEGbaZcpz65gU46hJ arGvlrIHItWWKhzXYlqJdppTXVz1o21ljxP6CQV9McxKoIG/ZkS/A/Cr5zvo8Be4rwyT mKS2DoogJZ9LavuT8OWu5Oigti427UPJwIQs6vvsM8n9pLFkJUmtn9zjDej89rzyAnmk SNZwsa78EM5r8RLGwBDY9Na0i3Pys+exIZYXdx6OuPGeE4wQRNfueB9mjuJl7Tg4YoW0 mlXeaqj2QWkedj1qVHwjhv2iTPVYIL4wAUA9AjWj8sQ0nGpCqao6wTP2g/NXbRJRvM6E yE0w==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
# 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author