rest-nvim / rest.nvim

A fast Neovim http client written in Lua
GNU General Public License v3.0
1.35k stars 117 forks source link

fix: run highlight callback on same buffer #395

Open fmgornick opened 2 weeks ago

fmgornick commented 2 weeks ago

i have the following config set:

config = {
  result = {
    split = {
      stay_in_current_window_after_split = false,
    },
  },
}

but with this, i noticed that whenever i ran a request and my cursor switched buffers to the response, my request was permanently highlighted. It looks like this is because the call to utils.highlight uses bufnr = 0, meaning that the deffered call to vim.api.nvim_buf_clear_namespace will (most likely) run in the response buffer.

so i just changed this to use the exact bufnr so the callback function only runs on the buffer that was initially highlighted.