Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting an error when opening nvim-tree while using cat or lolcat to display the header #468

Open
ingenarel opened this issue Jul 9, 2024 · 6 comments

Comments

@ingenarel
Copy link

ingenarel commented Jul 9, 2024

Describe the bug
i'm getting an error when opening nvim-tree to browse my files when i'm using cat or lolcat to display the header.

To Reproduce
Steps to reproduce the behavior:

  1. use a config like this that uses cat or lolcat to display the output:
require("dashboard").setup(
    {
        theme = 'hyper',
        config = {
            packages = {enabled=false},
            project = {enable=false},
            mru = {limit=20},
            footer = {
                "",
                "Live",
                "Not for yourself",
                "But for her."
            },
        },
        preview = {
            command = "lolcat",
            file_path = "~/.config/nvim/lua/_plugins_/karambit-lighter.txt",
            file_height = 19,
            file_width = 59,
        }
    }
)
  1. open up nvim tree
  2. See error:
Error detected while processing WinResized Autocommands for "*":
Error executing lua callback: ...re/nvim/plugged/dashboard-nvim/lua/dashboard/preview.lua:71: attempt to index field 'col' (a number value)                                                                                                    
stack traceback:                                                                                                                                                                                                                               
        ...re/nvim/plugged/dashboard-nvim/lua/dashboard/preview.lua:71: in function 'refresh_preview_wincol'                                                                                                                                   
        ...re/nvim/plugged/dashboard-nvim/lua/dashboard/preview.lua:82: in function <...re/nvim/plugged/dashboard-nvim/lua/dashboard/preview.lua:81>                                                                                           
Press ENTER or type command to continue                                                                                                                                           

image

and if i press esc and try to use it, the header gets messes up. ik the header is another buffer because i can go to the header and open up another file like this:
image
but it doesn't change the position properly as you can see:
image

@interbattles
Copy link

what terminal is that ? it has to do with not being able to count the columns i cant really get around this because im using neovide

@ingenarel
Copy link
Author

what terminal is that ? it has to do with not being able to count the columns i cant really get around this because im using neovide

it's kitty. btw sorry for the late reply.

@interbattles
Copy link

i cant reproduce this in my default kitty so my guess is it's something to do with your terminfo or youre missing ncurses so it cant call tput cols maybe (total shot in the dark)

@ingenarel
Copy link
Author

i checked and i do have ncurses installed. i'm using hyprland on arch. maybe it has something to do with how wayland works or something?

@TheRealGLH
Copy link

i checked and i do have ncurses installed. i'm using hyprland on arch. maybe it has something to do with how wayland works or something?

I'm not sure this is a Wayland thing, I'm getting the exact same problem in Bash on WSL and ZSH on MacOS.

@NarvinSingh
Copy link

NarvinSingh commented Sep 2, 2024

I had the same problem (also using Kitty, but I don't believe this has anything to do with the terminal). The issue looks to be spelled out in the traceback @ingenarel posted in the issue. I patched 3 places in preview.lua of my local version of the plugin and it resolved the issue for me. (My issue was triggered when I opened a side panel, Neo-tree, while dashboard was open.)

I don't understand the logic behind col[false]. It seems col will be always be a number or nil. Maybe this is a typo? At any rate, removing the indexing [false] from lines 61 and 71 resolved the error for me. Although, the header (produced by the lolcat output) remains centered in the resized dashboard window, and bleeds into the sidebar window--but I can live with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants