Skip to content

Commit

Permalink
fix rendering of ListPrompt for odd pageSizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Jan 2, 2024
1 parent 258549b commit a26686c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ private IRenderable BuildRenderable(ListPromptState<T> state)
skip = Math.Max(0, state.Index - middleOfList);
take = Math.Min(pageSize, state.ItemCount - skip);

if (state.ItemCount - state.Index < middleOfList)
if (take < pageSize)
{
// Pointer should be below the end of the list
var diff = middleOfList - (state.ItemCount - state.Index);
// Pointer should be below the middle of the (visual) list
var diff = pageSize - take;
skip -= diff;
take += diff;
cursorIndex = middleOfList + diff;
Expand Down

0 comments on commit a26686c

Please sign in to comment.