Giter Site home page Giter Site logo

Bug: Invalid window ID about lualine.nvim HOT 9 CLOSED

refLog2112 avatar refLog2112 commented on June 8, 2024 1
Bug: Invalid window ID

from lualine.nvim.

Comments (9)

folke avatar folke commented on June 8, 2024 1

Still can't reproduce. Since both noice and lualine are part of LazyVim which is used by thousands of people, I would also be very surprised there's an interop issue there.

Feel free to open an issue in the noice repo with a minimal repro as instructed in the issue template.

from lualine.nvim.

liath avatar liath commented on June 8, 2024

Added some guards around the failing line and it seems to clear this up:

diff --git a/lua/lualine.lua b/lua/lualine.lua
index 6093049..e75f79e 100644
--- a/lua/lualine.lua
+++ b/lua/lualine.lua
@@ -426,8 +426,13 @@ local function refresh(opts)
           and vim.fn.win_gettype(refresh_real_curwin) == 'popup'
           and refresh_real_curwin
         or win
-      local stl_cur = vim.api.nvim_win_call(refresh_real_curwin, M.statusline)
+
+      local win_is_num = type(refresh_real_curwin) == "number"
+      local win_is_valid = win_is_num and vim.api.nvim_win_is_valid(refresh_real_curwin)
+
+      local stl_cur = win_is_valid and vim.api.nvim_win_call(refresh_real_curwin, M.statusline) or ""
       local stl_last = modules.nvim_opts.get_cache('statusline', { window = set_win })
+
       if stl_cur or stl_last then
         modules.nvim_opts.set('statusline', stl_cur, { window = set_win })
       end

There's probably a better fix that would answer why refresh_real_curwin is ocassionally:

  • nil
  • an invalid window id (perhaps a race happening somewhere?)

from lualine.nvim.

refLog2112 avatar refLog2112 commented on June 8, 2024

@liath Indeed this fix kind of works, but is hiding the status line.
@folke is there something that can be related to Noice?

Regardless of how many splits are there, the Invalid window id: 1001 is always the error cause.

from lualine.nvim.

liath avatar liath commented on June 8, 2024

I reverted my change to see if I could find a better solution but can't seem to reproduce now. I pulled updates fwiw, maybe it'll help you @refLog2112

from lualine.nvim.

folke avatar folke commented on June 8, 2024

I dont see this issse. What are the exact steps to reproduce this using Noice and lualine?

from lualine.nvim.

refLog2112 avatar refLog2112 commented on June 8, 2024

@folke Here are the steps with a little demo

  1. Open 2+ buffers and put them in split
  2. Switch between the splits
  3. Open command line in each
    steps

from lualine.nvim.

refLog2112 avatar refLog2112 commented on June 8, 2024

The issue seems to be a job started with plenary. Closing this issue.

from lualine.nvim.

AlexvZyl avatar AlexvZyl commented on June 8, 2024

@refLog2112 Running into the same issue. Would you mind sharing what your fix was?

from lualine.nvim.

refLog2112 avatar refLog2112 commented on June 8, 2024

@AlexvZyl I see that you have also a plenary job that does the git compare and put it the lualine. Actually, I just disabled that section for now, and all was fine.

        -- Run job to get git.
        local result = Job:new({
            command = 'git',
            cwd = curr_dir,
            args = { 'rev-list', '--left-right', '--count', 'HEAD...@{upstream}' },
        })
            :sync(100)[1]
            {
                U.get_git_compare,
                separator = ' ',
                padding = 0,
                color = text_hl,
            },

My guess is that plenary creates a window id which no longer exists after the job is done.

from lualine.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.