mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52:50 +08:00
(#1363) fix rendering of ListPrompt for odd pageSizes
This commit is contained in:
parent
006da0f9ea
commit
6f1f29967d
@ -89,10 +89,10 @@ internal sealed class ListPrompt<T>
|
|||||||
skip = Math.Max(0, state.Index - middleOfList);
|
skip = Math.Max(0, state.Index - middleOfList);
|
||||||
take = Math.Min(pageSize, state.ItemCount - skip);
|
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
|
// Pointer should be below the middle of the (visual) list
|
||||||
var diff = middleOfList - (state.ItemCount - state.Index);
|
var diff = pageSize - take;
|
||||||
skip -= diff;
|
skip -= diff;
|
||||||
take += diff;
|
take += diff;
|
||||||
cursorIndex = middleOfList + diff;
|
cursorIndex = middleOfList + diff;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user