Skip to content

Commit

Permalink
Merge pull request #28 from ChrisPulman/FixListPrompt
Browse files Browse the repository at this point in the history
fix rendering of ListPrompt for odd pageSizes
  • Loading branch information
ChrisPulman authored Jan 2, 2024
2 parents a1fa89b + a26686c commit 503e0a1
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 503e0a1

Please sign in to comment.