mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	(#1363) fix rendering of ListPrompt for odd pageSizes
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							006da0f9ea
						
					
				
				
					commit
					6f1f29967d
				
			@@ -89,10 +89,10 @@ internal sealed class ListPrompt<T>
 | 
			
		||||
            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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user