You are not logged in.

#1 2013-07-28 10:23:04

whoops
Member
Registered: 2009-03-19
Posts: 891

[solved]ZSH history search breaks after running wine

Hi!

I have history search with up/down keys set up in zsh. I think this might be those lines in /etc/zshrc?

bindkey "^R" history-incremental-pattern-search-backward 
bindkey "^S" history-incremental-pattern-search-forward

... but maybe more. Not sure where to look and what to look for. If I remember right, I took all of it from grml-zsh-config in the arch repos; there are no relevant configs beyond that (no per user; all in /etc/zsh).

Anyway: After I run wine (any windows executable) from a terminal, this feature breaks and instead of searching history, the up/down keys just give me the last/next history item disregarding what I already entered. Can always reproduce the problem by running winecfg in zsh and then pressing ctrl+c - maybe the unclean exit has something to do with it?

I tried:
- lxterminal instead of xfce4-terminal. Same problem there.
- source(ing) /etc/zsh/* or just some of the files again after it happens does not fix the problem.
- entering the bindkeys lines (above) manually does not change anything either
- restarting the terminal / tab with zsh and opening a new one is the only thing I found helps.

Beyond that: Can't begin to imagine how that happens so I have no idea how to begin trying to fix it.


Any hints?

Last edited by whoops (2013-07-28 11:21:38)

Offline

#2 2013-07-28 10:41:14

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [solved]ZSH history search breaks after running wine

What's the output of

bindkey | egrep '^"(\^\[[O[][AB])"'

before and after running winecfg?

Edit:
How exactly did you bind up/down to history search?
What is the output of <Ctrl-v><Up>? Does it change before/after?
Also does the `reset` command fix it?

Last edited by lolilolicon (2013-07-28 10:45:11)


This silver ladybug at line 28...

Offline

#3 2013-07-28 10:54:47

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: [solved]ZSH history search breaks after running wine

Looks the same to me:

zsh/3 1920 % bindkey | egrep '^"(\^\[[O[][AB])"'
"^[OA" up-line-or-history
"^[OB" down-line-or-history
"^[[A" up-line-or-beginning-search
"^[[B" down-line-or-beginning-search
[So 13/07/28 12:47 CEST][pts/1][x86_64/linux-gnu/3.9.9-1-ARCH][5.0.2]
<user@arch:~>
zsh/3 1921 % winecfg
^Cfixme:console:CONSOLE_DefaultHandler Terminating process 8 on event 0
[So 13/07/28 12:47 CEST][pts/1][x86_64/linux-gnu/3.9.9-1-ARCH][5.0.2]
<user@arch:~>
zsh/3 1922 % bindkey | egrep '^"(\^\[[O[][AB])"'
"^[OA" up-line-or-history
"^[OB" down-line-or-history
"^[[A" up-line-or-beginning-search
"^[[B" down-line-or-beginning-search

During testing that though, I noticed that using nano / vim while has the same effect as restarting zsh / terminal and temporarily fixes the problem again. No idea if that's normal behaviour for that sort of stuff or if it "could be a clue" :3

edit:
OH!
from ctrl+v up:
While it works, I get: ^[[A
While it's broken, I get: ^[OA


Reset command *sometimes* fixes it. It works if I use winecfg to break history search. But in the past, it mostly  didn't when it broke by running other / random applications (I often tried that).


Beyond the two lines from my first post, I don't know how I bind the keys. It's all done by grml-zsh-config from the repos (After I switched from bash to zsh, I never really managed to understand the config to its full extent)

Last edited by whoops (2013-07-28 11:01:33)

Offline

#4 2013-07-28 11:00:41

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [solved]ZSH history search breaks after running wine

That's the thing, right there. If you explicitly bind both "^[OA" and "^[[A", the <Up> key will work consistently. The reason behind this I don't really have any knowlege of, though.


This silver ladybug at line 28...

Offline

#5 2013-07-28 11:21:14

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: [solved]ZSH history search breaks after running wine

Thanks that helped, I think I found those lines!
Guess my grml-config partly didn't update because I had to manually add an unrelated (color definition) bugfix some months ago.

After I got rid of the obsolete parts that used binds to  "^[OA" and "^[[A"  the problem was gone.
If I understood it right, newer version of grml-zsh-config use this method instead (or if not - something I didn't recognize at all):

/etc/zsh/zshrc:#k# search history backward for entry beginning with typed text
/etc/zsh/zshrc:bind2maps emacs viins       -- -s '^xp' history-beginning-search-backward-end
/etc/zsh/zshrc:#k# search history forward for entry beginning with typed text
/etc/zsh/zshrc:bind2maps emacs viins       -- -s '^xP' history-beginning-search-forward-end
/etc/zsh/zshrc:#k# search history backward for entry beginning with typed text
/etc/zsh/zshrc:bind2maps emacs viins       -- PageUp history-beginning-search-backward-end
/etc/zsh/zshrc:#k# search history forward for entry beginning with typed text
/etc/zsh/zshrc:bind2maps emacs viins       -- PageDown history-beginning-search-forward-end
/etc/zsh/zshrc:bind2maps emacs viins       -- -s "^x^h" commit-to-history

Should wine be changing the mode at which the arrow keys operate or whatever all of it meant?
Not sure if I should submit a bug report somewhere or if all of it was just misconfiguration on my part.

Last edited by whoops (2013-07-28 11:22:09)

Offline

Board footer

Powered by FluxBB