Skip to content

panic and crashing with index out of range #516

Description

@amdemas

What is the peco version, OS, architecture?

peco version v0.5.8 (built with go1.14.2) <- Pulled from the releases page
Fedora 33

Abstract

Every time peco is called it fails

Discussion

Here is the output of the failure

panic: runtime error: index out of range [2] with length 0

goroutine 26 [running]:
github.com/nsf/termbox-go.SetCursor(0x6, 0x0)
	/Users/lestrrat/dev/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20190817171036-93860e161317/api.go:214 +0x16e
github.com/peco/peco.(*Termbox).SetCursor(0xc00000c240, 0x6, 0x0)
	/Users/lestrrat/dev/src/github.com/peco/peco/screen.go:38 +0x35
github.com/peco/peco.UserPrompt.Draw(0xc0001801c0, 0x7ffe55b90be7, 0x5, 0x5, 0xc00014434a, 0xc000144000)
	/Users/lestrrat/dev/src/github.com/peco/peco/layout.go:189 +0x3ce
github.com/peco/peco.(*BasicLayout).DrawPrompt(...)
	/Users/lestrrat/dev/src/github.com/peco/peco/layout.go:672
github.com/peco/peco.(*BasicLayout).DrawScreen(0xc000180200, 0xc000144000, 0x0)
	/Users/lestrrat/dev/src/github.com/peco/peco/layout.go:688 +0xb4
github.com/peco/peco.(*View).drawScreen(0xc000180220, 0x621700, 0xc0001800e0, 0x0)
	/Users/lestrrat/dev/src/github.com/peco/peco/view.go:86 +0x76
github.com/peco/peco.(*View).Loop(0xc000180220, 0x6221c0, 0xc000110c40, 0xc00000ce60, 0x0, 0x0)
	/Users/lestrrat/dev/src/github.com/peco/peco/view.go:66 +0x376
created by github.com/peco/peco.(*Peco).Run.func4
	/Users/lestrrat/dev/src/github.com/peco/peco/peco.go:369 +0x1ed

Here is a sample of what is being called

function peco-ssh {
  local host=$(grep '^Host' ~/.ssh/config | awk '{ print $2 }' | peco --prompt '[ssh]')
  if [ -n "${host}" ]; then
    echo "ssh ${host}"
    \ssh ${host}
  fi
}
alias pssh='peco-ssh'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions