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

hit-enter prompt with vim.err_write with redraw before last line (deoplete) #327

Open
blueyed opened this issue Apr 25, 2018 · 6 comments
Open

Comments

@blueyed
Copy link
Contributor

blueyed commented Apr 25, 2018

The following will not trigger a hit-enter prompt:

:py3 import vim; vim.err_write('\n'.join(str(x) for x in range(10))+'\n'); vim.command('redraw'); vim.err_write('last\n')

It displays the lines 0-9, then waits for a short time, and displays "last".
This is good/useful when wanting to add a traceback/more info for :messages, but have the actual error in the end (without a large red blob).

But for some reason similar code in deoplete will not (when adding a redraw command before the last line) - it displays all of it at once, causing a hit-enter prompt: https://github.com/Shougo/deoplete.nvim/blob/57d3f0c3cdfcfc1d91901a6d59d08f9008abd166/rplugin/python3/deoplete/util.py#L94-L101

This might be related to how deoplete integrates with neovim-python-client (https://github.com/Shougo/deoplete.nvim/blob/master/rplugin/python3/deoplete/parent.py#L96-L102).

@justinmk
Copy link
Member

I'm not sure why the first case "waits". That seems like an accident, doesn't it?

@blueyed
Copy link
Contributor Author

blueyed commented Apr 27, 2018

Agreed. I've thought that it might be intentional, but I also think that it should not wait.
The main issue is that the second case even triggers the hit-enter prompt though.

@justinmk
Copy link
Member

I don't understand why it's a problem for an error message to trigger hit-enter? Isn't that normal?

@blueyed
Copy link
Contributor Author

blueyed commented Apr 28, 2018

The trick that deoplete uses is to first use echom for additional info (traceback), then redraw and then echom for the main msg.
This way you have it in :messages, but are not bothered with the full blob initially.
I've noticed that this does not work as expected when using vim.err_write.

@justinmk
Copy link
Member

Try nvim_call_atomic or server-side VimL/Lua ?

@blueyed
Copy link
Contributor Author

blueyed commented Apr 28, 2018

@justinmk
Please elaborate.
Do you mean to do this from deoplete's error_tb (Python)? (https://github.com/Shougo/deoplete.nvim/blob/57d3f0c3cdfcfc1d91901a6d59d08f9008abd166/rplugin/python3/deoplete/util.py#L94-L101)
deoplete uses rpcnotify to trigger the Python code.

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

No branches or pull requests

2 participants