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

Preview was closed immediately as soon as it was opened on Vim 8 #16

Closed
voldikss opened this issue May 4, 2019 · 7 comments
Closed
Labels

Comments

@voldikss
Copy link
Contributor

voldikss commented May 4, 2019

Vim version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
including patch: 1-1453

This plugin works perfect on Neovim. but on Vim 8, the preview window will crash on the moment it is created if I set updatetime to 100.

Is this a bug of Vim? Do we have a solution for the problem?

@voldikss
Copy link
Contributor Author

voldikss commented May 4, 2019

In addition, if the cursor is on the top line of the page, this issue will not occur anymore.

@voldikss voldikss changed the title Preview was closed immediately as soon as it was opened on Vim 8 when updatetime was set to 100 Preview was closed immediately as soon as it was opened on Vim 8 May 4, 2019
@rhysd
Copy link
Owner

rhysd commented May 4, 2019

It seems that this plugin does not work on Vim8 correctly. I did not notice that because tests are run only for Neovim for now.

On my laptop, updatetime seems not related. First :GitMessenger does not open window, but second try opens window as intended.

@rhysd rhysd added the bug label May 4, 2019
@rhysd
Copy link
Owner

rhysd commented May 4, 2019

It seems that this is a problem of behavior of job feature on Vim8. I'll try to make a workaround.

@voldikss
Copy link
Contributor Author

voldikss commented May 4, 2019

Wow, it's astonishing. I ever thought it was a preview-windows problem or Vim itself...

@rhysd
Copy link
Owner

rhysd commented May 4, 2019

Could you check 8e71f4d fixes this issue? At least on my laptop, it seems to have gone.

@voldikss
Copy link
Contributor Author

voldikss commented May 4, 2019

Yes! The problem was solved. Now this plugin works normally on Vim 8. It's awesome!

Hmmm, cloud you tell me in brief that how did you found that cause?
Since the plugin has this code

autocmd CursorMoved,CursorMovedI,InsertEnter <buffer> call <SID>on_cursor_moved()

I ever thought the cursor's movement event caused that issue, but it didn't moved, which made me puzzled. How did you directly found that the ringleader is "job's channel hadn't been closed after callback function was called"

Thanks.

@rhysd
Copy link
Owner

rhysd commented May 4, 2019

I also thought that a cursor move would cause this issue. However, I noticed that window was actually not opened while the issue. I found it by dumping trace data by giving -V8log.txt to vim command. It is a good point to start debugging since many events are logged in the file to know what happens.

Then I added some debug prints to out_cb, err_cb and exit_cb and found that there was a situation that I did not expect. When exit_cb is called, I thought stdout and stderr channels were closed, but actually there were some cases where channels were still open. So I added a workaround to wait for the channels being closed with blocking polling loop.

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

No branches or pull requests

2 participants