mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	chore: support narrow terminal windows for messages (#18714)
This patch starts using a message box that's not really a box and thus is better behaving on a narrow-width terminals. Before: <img width="744" alt="image" src="https://user-images.githubusercontent.com/746130/201216551-abbac0f8-71b4-413f-9f4e-159c7123ef3d.png"> After: <img width="745" alt="image" src="https://user-images.githubusercontent.com/746130/201216504-25257727-06c8-4ae9-8557-a2d937b7ca0b.png"> Signed-off-by: Andrey Lushnikov <aslushnikov@gmail.com> Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
		
							parent
							
								
									db826c9c8c
								
							
						
					
					
						commit
						23171c5037
					
				| @ -191,12 +191,10 @@ export function constructURLBasedOnBaseURL(baseURL: string | undefined, givenURL | |||||||
| 
 | 
 | ||||||
| export function wrapInASCIIBox(text: string, padding = 0): string { | export function wrapInASCIIBox(text: string, padding = 0): string { | ||||||
|   const lines = text.split('\n'); |   const lines = text.split('\n'); | ||||||
|   const maxLength = Math.max(...lines.map(line => line.length)); |   const maxLineLength = Math.max(...lines.map(line => line.length)); | ||||||
|   return [ |   const separatorLength = process.stdout.columns || maxLineLength; | ||||||
|     '╔' + '═'.repeat(maxLength + padding * 2) + '╗', |   const separator = '═'.repeat(separatorLength); | ||||||
|     ...lines.map(line => '║' + ' '.repeat(padding) + line + ' '.repeat(maxLength - line.length + padding) + '║'), |   return [separator, ...lines, separator, ''].join('\n'); | ||||||
|     '╚' + '═'.repeat(maxLength + padding * 2) + '╝', |  | ||||||
|   ].join('\n'); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function isFilePayload(value: any): boolean { | export function isFilePayload(value: any): boolean { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Andrey Lushnikov
						Andrey Lushnikov