Skip to content

SelectionPrompt with odd page size can show smaller page size #1363

@reduckted

Description

@reduckted

Information

  • OS: Any
  • Version: 0.47.0
  • Terminal: Any

Describe the bug
When using SelectionPrompt with an odd page size, if you move the selection towards the end of the list, the number of choices shown in the page is reduced by one.

To Reproduce

using Spectre.Console;

namespace Playground;

class Program {
   static void Main() {
      var prompt = new SelectionPrompt<string>()
        .Title("Select one")
        .AddChoices(
            "One",
            "Two",
            "Three",
            "Four",
            "Five",
            "Six",
            "Seven",
            "Eight"
         ).PageSize(5);

      AnsiConsole.Prompt(prompt);
   }
}

Expected behavior
The list always shows the number of choices specified in the page size, regardless of which choice is selected.

Screenshots
selection-prompt

Additional context
An even page size always shows the correct number of choices.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions