mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 09:09:25 +08:00 
			
		
		
		
	Extends maximum size of remaining and elapsed time displayed, plus a failsafe
Elapsed and remaining now support > 9 hours, and if a timespan can't be rendered in that size **:**:** will be displayed
This commit is contained in:
		 Phil Scott
					Phil Scott
				
			
				
					committed by
					
						 Patrik Svensson
						Patrik Svensson
					
				
			
			
				
	
			
			
			 Patrik Svensson
						Patrik Svensson
					
				
			
						parent
						
							17ee8990f4
						
					
				
				
					commit
					04d0e663d5
				
			| @@ -1,5 +1,5 @@ | ||||
|                      | ||||
| foo ━━━ 0% -:--:-- ⣷ | ||||
| bar ━━━ 0% -:--:-- ⣷ | ||||
| baz ━━━ 0% -:--:-- ⣷ | ||||
| foo ━━ 0% --:--:-- ⣷ | ||||
| bar ━━ 0% --:--:-- ⣷ | ||||
| baz ━━ 0% --:--:-- ⣷ | ||||
|                      | ||||
|   | ||||
| @@ -22,16 +22,21 @@ namespace Spectre.Console | ||||
|             var elapsed = task.ElapsedTime; | ||||
|             if (elapsed == null) | ||||
|             { | ||||
|                 return new Markup("-:--:--"); | ||||
|                 return new Markup("--:--:--"); | ||||
|             } | ||||
|  | ||||
|             return new Text($"{elapsed.Value:h\\:mm\\:ss}", Style ?? Style.Plain); | ||||
|             if (elapsed.Value.TotalHours > 99) | ||||
|             { | ||||
|                 return new Markup("**:**:**"); | ||||
|             } | ||||
|  | ||||
|             return new Text($"{elapsed.Value:hh\\:mm\\:ss}", Style ?? Style.Plain); | ||||
|         } | ||||
|  | ||||
|         /// <inheritdoc/> | ||||
|         public override int? GetColumnWidth(RenderContext context) | ||||
|         { | ||||
|             return 7; | ||||
|             return 8; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -22,16 +22,21 @@ namespace Spectre.Console | ||||
|             var remaining = task.RemainingTime; | ||||
|             if (remaining == null) | ||||
|             { | ||||
|                 return new Markup("-:--:--"); | ||||
|                 return new Markup("--:--:--"); | ||||
|             } | ||||
|  | ||||
|             return new Text($"{remaining.Value:h\\:mm\\:ss}", Style ?? Style.Plain); | ||||
|             if (remaining.Value.TotalHours > 99) | ||||
|             { | ||||
|                 return new Markup("**:**:**"); | ||||
|             } | ||||
|  | ||||
|             return new Text($"{remaining.Value:hh\\:mm\\:ss}", Style ?? Style.Plain); | ||||
|         } | ||||
|  | ||||
|         /// <inheritdoc/> | ||||
|         public override int? GetColumnWidth(RenderContext context) | ||||
|         { | ||||
|             return 7; | ||||
|             return 8; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user