max397574 / startup.nvim

A highly configurable neovim startup screen
GNU General Public License v2.0
443 stars 35 forks source link

Cursor position outside buffer. #23

Open Icy-Thought opened 2 years ago

Icy-Thought commented 2 years ago

Describe the bug Startup won't launch due to cursor position being placed outside buffer.

Checklist

To Reproduce Steps to reproduce the behavior:

  1. Add startup.nvim to plugins.lua by coping the contents of the first source-block in the installation section of the README.md.
  2. :PackerSync.
  3. w/o dashboard config provided in this repo, the same error will arise.

Expected behavior The launch of startup.nvim w/o the provided configuration file.

Logs

Error executing vim.schedule lua callback: ...m/site/pack/packer/opt/startup.nvim/lua/startup/init.
lua:524: Cursor position outside buffer
stack traceback:
        [C]: in function 'nvim_win_set_cursor'
        ...m/site/pack/packer/opt/startup.nvim/lua/startup/init.lua:524: in function 'fn'
        vim.lua:415: in function 'cb'
        vim.lua:285: in function <vim.lua:285>

Additional Info Config dashboard.lua

Neovim Version NVIM v0.6.1

HrvojeFER commented 2 years ago

Same here.

max397574 commented 2 years ago

I have no problem when I use your config does it happen every time or just sometimes?

HrvojeFER commented 2 years ago

For me its every time.

Icy-Thought commented 2 years ago

Likewise and it does occur both when I use a config and when I refrain from using one.

AndreAugustoDev commented 2 years ago

I had this problem if the auto-session plugin has the auto restore option enabled One idea would be to check if this option is enabled, disable startup.nvim to avoid problems, or else display a warning that keeps both options active at the same time can cause problems Yes, the README has this information, but I think a built-in option would be interesting

This function does this check I mentioned:

function verify_auto_restore()
  if package.loaded['startup'] then
    if (package.loaded['auto-session'].conf.auto_restore_enabled == true) then
      vim.api.nvim_echo({{'WARNING: The auto_restore_enabled option of the auto-session plugin can cause startup problems in startup.nvim', 'ErrorMsg' }}, false, {})
    end
  end
end
max397574 commented 2 years ago

I wont

I had this problem if the auto-session plugin has the auto restore option enabled One idea would be to check if this option is enabled, disable startup.nvim to avoid problems, or else display a warning that keeps both options active at the same time can cause problems Yes, the README has this information, but I think a built-in option would be interesting

This function does this check I mentioned:

function verify_auto_restore()
  if package.loaded['startup'] then
    if (package.loaded['auto-session'].conf.auto_restore_enabled == true) then
      vim.api.nvim_echo({{'WARNING: The auto_restore_enabled option of the auto-session plugin can cause startup problems in startup.nvim', 'ErrorMsg' }}, false, {})
    end
  end
end

I won't do that Because there are just so many auto sessions. You could do this yourself or use the options specified in the readme: https://github.com/startup-nvim/startup.nvim#conflicts-with-other-plugins-like-auto-session

@Icy-Thought @HrvojeFER do you also use auto session plugins?

Icy-Thought commented 2 years ago

Yes.

haras-unicorn commented 2 years ago

I don't. It could be something else for me though if @Icy-Thought confirms that auto-session is the source of the problem.

EDIT: sry for the late reply and im @HrvojeFER - this is just a different account

distek commented 1 year ago

Was playing around with this.

If I pass an empty table to the startup (startup({}), it shows the error.

I copied the default "dashboard" config into my startup config directly and it starts fine. Then I:

I think I figured it out? If I have a section that only has one line of content, it errors (like the default footer section), but if I add two blank lines, it works fine:

require("startup").setup({

    header = {
        type = "text",
        oldfiles_directory = false,
        align = "center",
        fold_section = false,
        title = "Something",
        margin = 1,
        content = {
            "",
            "", -- If I delete this, I get the error.
        },
        highlight = "Normal",
        default_color = "",
        oldfiles_amount = 0,
    },
    parts = {"header"},
})

The error also occurs if you don't provide any sections in the user config. That should probably be caught ahead of time with a warning so people know why startup didn't do anything.

cdmistman commented 11 months ago

i can confirm the issue appears to be empty {} being passed to setup. I checked and it appears to be due to the default settings that get merged with the the argument to setup if it exists - this commit makes Startup not break for me.

Dani-0TB commented 5 months ago

Was having this exact issue, and just not providing an empty table to setup fixed it