Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bound widget return code lost #135

Closed
stnutt opened this issue Mar 12, 2016 · 5 comments
Closed

bound widget return code lost #135

stnutt opened this issue Mar 12, 2016 · 5 comments

Comments

@stnutt
Copy link

stnutt commented Mar 12, 2016

For a bound widget, the return code of the invocation of the original widget is not returned.

This a problem with zaw where the zaw-select-src widget will return 1 in the event a send-break is issued or if there are no matches, telling zaw to exit.

@ericfreese
Copy link
Member

You are right that the return code of the original widget is not being correctly returned, but I have yet to personally find a case where it's needed, and I'm having trouble reproducing the error you're describing.

I'm not familiar with zaw, and I honestly don't understand what the point of it is, but this is what I've tried:

% zsh -f
%% source ~/.zsh/zsh-autosuggestions.zsh
%% source ~/.zsh/zaw/zaw.zsh
%% bindkey '^R' zaw-select-src
%% bindkey '^G'
"^G" send-break
# I then press '^R' to invoke zaw-select-src.
# After the select source menu comes up, I press '^G' to issue a send-break.
# Zaw exits and I'm returned to the prompt. All seems fine.

Can you give a clearer description of what exact problem you're having?

@stnutt
Copy link
Author

stnutt commented Mar 15, 2016

Sure. WIth zaw sourced, you press CTRL-x followed by semicolon to start the zaw widget. Zaw itself then invokes the zaw-select-src widget, which is what draws and filters the menu. This widget will then exit if you press CTRL-g (send-break) or hit enter and return control back to the zaw widget. If you've hit CTRL-g or hit enter without matching anything then zaw-select-src will return 1 indicating to zaw that there's no match and there's nothing else to do. However, with the widget bound, zaw-select-src always returns 0, and zaw thinks that there's a match and that there's something to execute which results in the following error because it's trying to execute a command that's just an empty string.

zaw:20: permission denied: now loading ...

You can see zaw calling zaw-select-src and checking the return code in zaw.zsh at around line 80.

I imagine that there's probably other use cases where having the return code is necessary.

@ericfreese
Copy link
Member

Awesome, thanks for all the detailed info! I'll fix this soon.

@ericfreese
Copy link
Member

@stnutt Just pushed a fix to branch fixes/bound_widget_return_code. Please try that branch and let me know if it solves the problem for you.

See PR #140.

ericfreese added a commit that referenced this issue Apr 14, 2016
Keep track of return value from original widget (#135)
@ericfreese
Copy link
Member

Went ahead and merged. Should be fixed with the release of 0.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants