mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	Add function to render a hyperlink
It might seem cleaner to integrate this into the text style system, so that you
could say `ts := ts.Url("some link")` and then `ts.Sprint("my text")`. However,
this would require adding a new field to TextStyle, which I didn't want to do.
			
			
This commit is contained in:
		
							
								
								
									
										13
									
								
								pkg/gui/style/hyperlink.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								pkg/gui/style/hyperlink.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| package style | ||||
|  | ||||
| import "fmt" | ||||
|  | ||||
| // Render the given text as an OSC 8 hyperlink | ||||
| func PrintHyperlink(text string, link string) string { | ||||
| 	return fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", link, text) | ||||
| } | ||||
|  | ||||
| // Render a link where the text is the same as a link | ||||
| func PrintSimpleHyperlink(link string) string { | ||||
| 	return fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", link, link) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user