* How can I debug lost keyboard input?
@ 2018-09-12 18:42 Andy Spiegl
2018-09-19 18:27 ` Andy Spiegl
0 siblings, 1 reply; 6+ messages in thread
From: Andy Spiegl @ 2018-09-12 18:42 UTC (permalink / raw)
To: Zsh-Users List
Hi,
my problem I tried to summarize in the subject line is:
Since the recent OS upgrade to Ubuntu 18.04 my zsh (5.4.2) behaves
strangely when typing keys together with Meta + Shift. The first time I
type e.g. Meta+Shift+f nothing happens. The second time (and all following
times) the bound function is executed and everything seems normal.
I've bound finer-forward-word to Meta+Shift+f and finer-backward-word to Meta+Shift+b
They are defined as follows:
--------
finer-forward-word() {
local WORDCHARS=$WORDCHARS_FINER
zle forward-word
}
finer-backward-word() {
local WORDCHARS=$WORDCHARS_FINER
zle backward-word
}
--------
export WORDCHARS='*?_-.[]~=/&;!%^(){}<>+:@'
export WORDCHARS_FINER='?~&!%'
zle -N finer-forward-word
zle -N finer-backward-word
bindkey "^[F" finer-forward-word
bindkey "^[B" finer-backward-word
--------
All my other keybindings work normally. Just these two are crazy.
BTW if I bind the functions to a different key the same thing happens.
Uhm, as if the function would have to be loaded/initialized on the first try?
I know I should let you know about the rest of my zsh config but it has
grown pretty large over the last decades. :-) But nothing except some
aliases has changed during the last months so the problem must have to do
with the upgrade.
Any ideas how I can debug this?
Thanks,
Andy
--
Experience is something you don't get until just after you need it.
(Olivier)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I debug lost keyboard input?
2018-09-12 18:42 How can I debug lost keyboard input? Andy Spiegl
@ 2018-09-19 18:27 ` Andy Spiegl
2018-09-19 19:42 ` Jérémie Roquet
2018-09-20 10:10 ` Mikael Magnusson
0 siblings, 2 replies; 6+ messages in thread
From: Andy Spiegl @ 2018-09-19 18:27 UTC (permalink / raw)
To: zsh-users
> Any ideas how I can debug this?
Unfortunately I still don't know a good way to debug problems like that.
This time, I found the solution by reading zsh man pages over and over. :-)
> BTW if I bind the functions to a different key the same thing happens.
> Uhm, as if the function would have to be loaded/initialized on the first try?
Turned out to be exactly that. On the first call the function file is
loaded and the function initialized but NOT executed. So, I added the line
"zle finer-forward-word" at the end of the function file - after the
function definition. And now it works as expected again. zsh's default
behavior of this must have changed recently, right?
--------
finer-forward-word() {
local WORDCHARS=$WORDCHARS_FINER
zle forward-word
}
zle finer-forward-word
--------
But is that the "correct" way to do it or just a dumb workaround?
Thanks,
Andy
--
The typewriting machine, when played with expression, is no more
annoying than the piano when played by a sister or near relation.
(Oscar Wilde)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I debug lost keyboard input?
2018-09-19 18:27 ` Andy Spiegl
@ 2018-09-19 19:42 ` Jérémie Roquet
2018-09-20 9:47 ` Andy Spiegl
2018-09-20 10:10 ` Mikael Magnusson
1 sibling, 1 reply; 6+ messages in thread
From: Jérémie Roquet @ 2018-09-19 19:42 UTC (permalink / raw)
To: Zsh Users
Hi Andy,
2018-09-19 20:27 GMT+02:00 Andy Spiegl <zsh.Andy@spiegl.de>:
> finer-forward-word() {
> local WORDCHARS=$WORDCHARS_FINER
> zle forward-word
> }
> zle finer-forward-word
>
> is that the "correct" way to do it or just a dumb workaround?
I'm not sure what the “correct” way is, but I've always done as follow:
my-widget() {
// …
}
zle -N my-widget
Best regards,
PS: thanks a lot for the “finer WORDCHARS” idea; I'm going to use this too!
--
Jérémie
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I debug lost keyboard input?
2018-09-19 19:42 ` Jérémie Roquet
@ 2018-09-20 9:47 ` Andy Spiegl
0 siblings, 0 replies; 6+ messages in thread
From: Andy Spiegl @ 2018-09-20 9:47 UTC (permalink / raw)
To: zsh-users
Hello Jérémie,
> I'm not sure what the “correct” way is, but I've always done as follow:
...
> zle -N my-widget
I had tried that, too, but it only works without "-N".
According to "man zshzle" you are right but it has no effect. :-(
> PS: thanks a lot for the “finer WORDCHARS” idea; I'm going to use this too!
You are welcome. I've been using it for 15 years now. :-)
The implementation is from Oliver Kiddle.
--> http://www.zsh.org/mla/users/2003/msg00824.html
Thanks,
Andy
--
That's the funny thing about havin' a kid.
They come with their own set of problems;
make everything else you were worried about seem kinda silly.
(Greg Garcia)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I debug lost keyboard input?
2018-09-19 18:27 ` Andy Spiegl
2018-09-19 19:42 ` Jérémie Roquet
@ 2018-09-20 10:10 ` Mikael Magnusson
2018-09-20 10:19 ` Andy Spiegl
1 sibling, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2018-09-20 10:10 UTC (permalink / raw)
To: Zsh Users
On Wed, Sep 19, 2018 at 8:27 PM, Andy Spiegl <zsh.Andy@spiegl.de> wrote:
>> Any ideas how I can debug this?
> Unfortunately I still don't know a good way to debug problems like that.
> This time, I found the solution by reading zsh man pages over and over. :-)
>
>> BTW if I bind the functions to a different key the same thing happens.
>> Uhm, as if the function would have to be loaded/initialized on the first try?
>
> Turned out to be exactly that. On the first call the function file is
> loaded and the function initialized but NOT executed. So, I added the line
> "zle finer-forward-word" at the end of the function file - after the
> function definition. And now it works as expected again. zsh's default
> behavior of this must have changed recently, right?
>
> --------
> finer-forward-word() {
> local WORDCHARS=$WORDCHARS_FINER
> zle forward-word
> }
> zle finer-forward-word
> --------
>
> But is that the "correct" way to do it or just a dumb workaround?
Your mails are somewhat unclear, but if you have these functions
defined in autoloadable files then they should look as following
% cat finer-forward-word
local WORDCHARS=$WORDCHARS_FINER
zle forward-word
Ie, do not include the "finer-forward-word() {" and "}" lines in the
file. Your original versions probably work if you use autoload -k, but
you don't show your autoload lines at all in the example.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I debug lost keyboard input?
2018-09-20 10:10 ` Mikael Magnusson
@ 2018-09-20 10:19 ` Andy Spiegl
0 siblings, 0 replies; 6+ messages in thread
From: Andy Spiegl @ 2018-09-20 10:19 UTC (permalink / raw)
To: zsh-users
> Ie, do not include the "finer-forward-word() {" and "}" lines in the
> file.
Oh, I see! Great, that really works.
> Your original versions probably work if you use autoload -k, but
> you don't show your autoload lines at all in the example.
Sorry. All files in ~/.zsh/functions are autoloaded like this:
##########
fpath=(
~/{local/lib/zsh,.zsh}/{functions,scripts}(N)
$fpath
)
typeset -gU fpath
autoload -U $^fpath/*(-.N.x:t)
##########
Andy
--
The only time people dislike gossip is when you gossip about them.
(Will Rogers)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-09-20 10:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12 18:42 How can I debug lost keyboard input? Andy Spiegl
2018-09-19 18:27 ` Andy Spiegl
2018-09-19 19:42 ` Jérémie Roquet
2018-09-20 9:47 ` Andy Spiegl
2018-09-20 10:10 ` Mikael Magnusson
2018-09-20 10:19 ` Andy Spiegl
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).