MunifTanjim / nui.nvim

UI Component Library for Neovim.
MIT License
1.62k stars 57 forks source link

Error in apply_workaround_for_float_relative_position_issue_18925 #252

Closed Leo310 closed 1 year ago

Leo310 commented 1 year ago

The problem is described here: https://github.com/jackMort/ChatGPT.nvim/issues/128

As the error appears to come out of nui.nvim I am opening this issue with the hope that you maybe have an idea of what is going on.

MunifTanjim commented 1 year ago

How to reproduce? Can you share minimal reproduction steps please?

Leo310 commented 1 year ago

I explained the problem in the original issue, but maybe I should have made the steps more clear.

To reproduce:

  1. get my chatgpt.nvim lua config
  2. install the latest ChatGPT.nvim with Lazy
  3. Setup ChatGPT.nvim as described in the README (providing OpenAI API-Key...)
  4. Run the command :ChatGPT
  5. Try to submit a prompt -> Error with the following Stack-Trace:
    Error executing vim.schedule lua callback: .../.local/share/nvim/lazy/nui.nvim/lua/nui/layout/init.lua:29: Vim(let):E716: Key not present in Dictionary: "rhs" stack traceback: 
    [C]: in function 'nvim_set_current_win' 
    .../.local/share/nvim/lazy/nui.nvim/lua/nui/layout/init.lua:29: in function 'apply_workaround_for_float_relative_position_issue_18925' 
    .../.local/share/nvim/lazy/nui.nvim/lua/nui/layout/init.lua:196: in function '_process_layout'
    .../.local/share/nvim/lazy/nui.nvim/lua/nui/layout/init.lua:395: in function 'update'
    ...ocal/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/module.lua:80: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>

But not everyone seems to face this problem. So I am not sure if you would be able to reproduce it.

MunifTanjim commented 1 year ago

Can you reproduce this on a clean neovim setup?

It might be caused by one of the plugins you are using. That'd be the reason why it's not reproducible by everybody.

Leo310 commented 1 year ago

Yeah you were right. For whatever reason, this plugin was causing the issue.

I don't know if it is worth investigating so you can close the issue from my side.

MunifTanjim commented 1 year ago

I think that plugin remaps <CR> and some other keys for every buffer: https://github.com/jiangmiao/auto-pairs/blob/39f06b873a8449af8ff6a3eee716d3da14d63a76/plugin/auto-pairs.vim#L603-L673

Ideally, it should ignore scratch buffers (https://neovim.io/doc/user/windows.html#scratch-buffer).