yorukot / superfile

Pretty fancy and modern terminal file manager

Home Page:https://superfile.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index out of range error causes Panic with example Vim bindings

sebshader opened this issue · comments

Describe the bug
when navigating in powershell a index out of range occurs after installing and running with hotkey file modified

To Reproduce
Steps to reproduce the behavior:

  1. Download in Powershell according to the instructions https://superfile.netlify.app/getting-started/installation/
  2. modify \AppData\Local/superfile/hotkeys.toml to the vim keybindings https://superfile.netlify.app/configure/custom-hotkeys#vim-like-superfile-hotkeys
  3. restart powershell
  4. run by typing 'spf'
  5. press 'j' (or any button?..)

Expected behavior
list_down occurs, moving the cursor down

Screenshots
Caught panic:

runtime error: index out of range [1] with length 1

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
/home/nightcat/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.3/tea.go:475 +0x91
panic({0xbb4760?, 0xc000516000?})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/runtime/panic.go:770 +0x132
github.com/yorukot/superfile/src/internal.model.Update({{{0xc000150d88, 0x1, 0x1}, 0x31, 0x0, 0x2, {0x1, 0x2f}}, {{0xc000162a00, 0xa, ...}, ...}, ...}, ...)
/home/nightcat/Documents/code/superfile/src/internal/model.go:135 +0x1a8f
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0001b22d0, {0xfcaa90?, 0xc000501008?}, 0xc000024360)
/home/nightcat/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.3/tea.go:408 +0x5ed
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0001b22d0)
/home/nightcat/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.3/tea.go:543 +0x9eb
github.com/yorukot/superfile/src/cmd.Run.func3(0xc000306080?)
/home/nightcat/Documents/code/superfile/src/cmd/main.go:68 +0x15c
github.com/urfave/cli/v2.(*Command).Run(0xc0001946e0, 0xc000306080, {0xc000036090, 0x1, 0x1})
/home/nightcat/go/pkg/mod/github.com/urfave/cli/v2@v2.27.2/command.go:276 +0x97d
github.com/urfave/cli/v2.(*App).RunContext(0xc000162000, {0xfcb578, 0x164d980}, {0xc000036090, 0x1, 0x1})
/home/nightcat/go/pkg/mod/github.com/urfave/cli/v2@v2.27.2/app.go:333 +0x58b
github.com/urfave/cli/v2.(*App).Run(...)
/home/nightcat/go/pkg/mod/github.com/urfave/cli/v2@v2.27.2/app.go:307
github.com/yorukot/superfile/src/cmd.Run({0xc00005e000?})
/home/nightcat/Documents/code/superfile/src/cmd/main.go:77 +0x28c
main.main()
/home/nightcat/Documents/code/superfile/main.go:15 +0x1a

System information (please complete the following information):

  • OS: Windows 10 Home
  • Version 10.0.19045
  • Superfile Version 1.1.3
  • tried with Powershell versions 5.1 and 7.4

this doesn't happen if the hotkeys file is the default bindings

if I add a second keybinding 'down' and 'up' to the vim list_down and list_up keybindings it doesn't happen (but still happens for any binding that only has 1 key bound it seems)

ok going back to the default config certain keys also cause it (pretty much anything except up/down and 'q' actually)

Whoops, sorry that's an update to the current latest version I forgot that this affects the previous version I'll change it to the old one first and then make the change!

If you want to solve it now you just need to change each array to ['key', ''].

ok going back to the default config certain keys also cause it (pretty much anything except up/down and 'q' actually)

As for this issue I think it's most likely due to incomplete support for windows.
Can you send error?

Thank you so much!

ok going back to the default config certain keys also cause it (pretty much anything except up/down and 'q' actually)

As for this issue I think it's most likely due to incomplete support for windows. Can you send error?

Thank you so much!

adding '' to every binding does fix it
I think it was the same issue for the default bindings as some do seem to have a single entry (it was the same stack trace as in the original comment)

ok going back to the default config certain keys also cause it (pretty much anything except up/down and 'q' actually)

As for this issue I think it's most likely due to incomplete support for windows. Can you send error?

Thank you so much!

actually I'm not sure what I did, I must have mixed the configs wrong or something because now I'm not seeing the issue with the default one. (and it does not have any with a single binding)
sorry for false report on that one

actually I'm not sure what I did, I must have mixed the configs wrong or something because now I'm not seeing the issue with the default one. (and it does not have any with a single binding)
sorry for false report on that one

Did you copy the default settings from the website?
If so, then I think it’s the same problem!

I appreciate you reporting this docs issue! :)

I guess that was probably it.
this seems like a good/solid file manager but in my opinion probably shouldn't crash/panic if there is a misconfiguration.. is this just docs issue?

I guess that was probably it. this seems like a good/solid file manager but in my opinion probably shouldn't crash/panic if there is a misconfiguration.. is this just docs issue?

I think this could also be considered a bug and I should add some hint to indicate to the user that there is an error in the setting file instead of having it panic...