toppair / reach.nvim

Buffer, mark, tabpage, colorscheme switcher for Neovim
MIT License
235 stars 7 forks source link

Ctrl-C breaks function when handling keystroke #10

Closed cissoid closed 2 years ago

cissoid commented 2 years ago

Reproduce:

  1. Run :ReachOpen buffers.
  2. Press Ctrl-C.

Behavior: Show this error log, and leave floating window opened, no normal way to close it.

E5108: Error executing lua: Keyboard interrupt
stack traceback:
        [C]: in function 'getcharstr'
        .../pack/packer/start/reach.nvim/lua/reach/buffers/init.lua:146: in function 'on_enter'
        .../site/pack/packer/start/reach.nvim/lua/reach/machine.lua:15: in function 'init'
        ...vim/site/pack/packer/start/reach.nvim/lua/reach/init.lua:84: in function <...vim/site/pack/packer/start/reach.nvim/lua/reach/init.lua:31>

https://github.com/toppair/reach.nvim/blob/50d91d2fed/lua/reach/buffers/init.lua#L146

Maybe use pcall(vim.fn.getcharstr) instead?

toppair commented 2 years ago

Sorry for the delay, should be fixed now. Let me know if anything broke.