Ron89 / thesaurus_query.vim

Multi-language Thesaurus Query and Replacement plugin for Vim/NeoVim
http://www.vim.org/scripts/script.php?script_id=5341
Apache License 2.0
220 stars 23 forks source link

Do not err on SIGINT/Ctrl-c #26

Closed rxw1 closed 6 years ago

rxw1 commented 6 years ago

Closing the split window by just pressing Enter works, but maybe it would be nice to handle Ctrl-C as well.

A more proper implementation would probably to use signal.signal(signal.SIGINT, func): https://stackoverflow.com/a/1112350/220472

Ron89 commented 6 years ago

Hi @rwilhelm , I have been noticing that Ctrl-C doesn't work well with Neovim for some time. But was treating it as a neovim problem because that KeyboardInterupt exception should have captured the interupt signal induced exception. And it did, for Vim.

I have seen your code. Changing None to 0 will not change the logic of that specific function. So I ignored the change. I have also tried to use package signal to inhibit the signal interrupt. Strangely, it does not do anything for either NeoVim or Vim.

After looking into the exception thrown in NeoVim. I realized that the reason my exception handler didn't manage to capture the correct exception because NeoVim API intercepted the exception and thrown a different one, neovim.api.nvim.NvimError. I specifically captured it on the occation, and now issue should be resolved. Please raise an issue to track it if it still affects you.

Also, if you are interested, please explore more on using signal interupt handling way of solution.