erikgeiser / promptkit

Go prompt library
MIT License
249 stars 21 forks source link

Init page of paged choices are in a weird order #18

Closed nemith closed 1 year ago

nemith commented 1 year ago

I have a program with a large list of items and the initial list of choices shown is in a odd order. It corrects itself if I apply a filter or start arrowing through (however only the items that have been selected are fixed)

Here is my sample program and a video of the issue.

package main

import (
    "fmt"
    "log"
    "strconv"

    "github.com/erikgeiser/promptkit/selection"
)

func main() {
    var choices []string
    for i := 0; i < 100; i++ {
        choices = append(choices, strconv.Itoa(i))
    }

    sel := selection.New("Select thingy:", choices)
    choice, err := sel.RunPrompt()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(choice)

}

https://github.com/erikgeiser/promptkit/assets/349360/631f4dd6-fe4f-4cf4-8a4e-90ba58c09f0c