Enable inline URLs by default on VTE terminals
This commit is contained in:
		@@ -867,7 +867,15 @@ func cmdToggle(cmd *Command) {
 | 
			
		||||
		case "showurls":
 | 
			
		||||
			val = &cmd.Config.Preferences.DisableShowURLs
 | 
			
		||||
		case "inlineurls":
 | 
			
		||||
			val = &cmd.Config.Preferences.InlineURLs
 | 
			
		||||
			switch cmd.Config.Preferences.InlineURLMode {
 | 
			
		||||
			case "enable":
 | 
			
		||||
				cmd.Config.Preferences.InlineURLMode = "disable"
 | 
			
		||||
				cmd.Reply("Force-disabled using fancy terminal features to render URLs inside text. Restart gomuks to apply changes.")
 | 
			
		||||
			default:
 | 
			
		||||
				cmd.Config.Preferences.InlineURLMode = "enable"
 | 
			
		||||
				cmd.Reply("Force-enabled using fancy terminal features to render URLs inside text. Restart gomuks to apply changes.")
 | 
			
		||||
			}
 | 
			
		||||
			continue
 | 
			
		||||
		case "newline":
 | 
			
		||||
			val = &cmd.Config.Preferences.AltEnterToSend
 | 
			
		||||
		default:
 | 
			
		||||
 
 | 
			
		||||
@@ -148,7 +148,7 @@ func (msg *FileMessage) CalculateBuffer(prefs config.UserPreferences, width int,
 | 
			
		||||
	if prefs.BareMessageView || prefs.DisableImages || len(msg.imageData) == 0 {
 | 
			
		||||
		url := msg.matrix.GetDownloadURL(msg.URL)
 | 
			
		||||
		var urlTString tstring.TString
 | 
			
		||||
		if prefs.InlineURLs {
 | 
			
		||||
		if prefs.EnableInlineURLs() {
 | 
			
		||||
			urlTString = tstring.NewStyleTString(url, tcell.StyleDefault.Hyperlink(url, msg.eventID.String()))
 | 
			
		||||
		} else {
 | 
			
		||||
			urlTString = tstring.NewTString(url)
 | 
			
		||||
 
 | 
			
		||||
@@ -234,7 +234,7 @@ func (parser *htmlParser) linkToEntity(node *html.Node) Entity {
 | 
			
		||||
		} else if matrixURI.Sigil1 == '#' {
 | 
			
		||||
			entity.Children = []Entity{text}
 | 
			
		||||
		}
 | 
			
		||||
	} else if parser.prefs.InlineURLs {
 | 
			
		||||
	} else if parser.prefs.EnableInlineURLs() {
 | 
			
		||||
		linkID := fmt.Sprintf("%s-%d", parser.evt.ID, parser.linkIDCounter)
 | 
			
		||||
		parser.linkIDCounter++
 | 
			
		||||
		entity.AdjustStyle(AdjustStyleLink(href, linkID), AdjustStyleReasonNormal)
 | 
			
		||||
@@ -426,7 +426,7 @@ func (parser *htmlParser) singleNodeToEntity(node *html.Node) Entity {
 | 
			
		||||
			node.Data = strings.ReplaceAll(node.Data, "\n", "")
 | 
			
		||||
			node.Data = spaces.ReplaceAllLiteralString(node.Data, " ")
 | 
			
		||||
		}
 | 
			
		||||
		return TextToEntity(node.Data, parser.evt.ID, parser.prefs.InlineURLs)
 | 
			
		||||
		return TextToEntity(node.Data, parser.evt.ID, parser.prefs.EnableInlineURLs())
 | 
			
		||||
	case html.ElementNode:
 | 
			
		||||
		parsed := parser.tagNodeToEntity(node)
 | 
			
		||||
		if parsed != nil && !parsed.IsBlock() && parsed.IsEmpty() {
 | 
			
		||||
 
 | 
			
		||||
@@ -208,7 +208,7 @@ func ParseMessage(matrix ifc.MatrixContainer, room *rooms.Room, evt *muksevt.Eve
 | 
			
		||||
			return NewHTMLMessage(evt, displayname, html.Parse(matrix.Preferences(), room, content, evt, displayname))
 | 
			
		||||
		}
 | 
			
		||||
		content.Body = strings.Replace(content.Body, "\t", "    ", -1)
 | 
			
		||||
		return NewHTMLMessage(evt, displayname, html.TextToEntity(content.Body, evt.ID, matrix.Preferences().InlineURLs))
 | 
			
		||||
		return NewHTMLMessage(evt, displayname, html.TextToEntity(content.Body, evt.ID, matrix.Preferences().EnableInlineURLs()))
 | 
			
		||||
	case event.MsgImage, event.MsgVideo, event.MsgAudio, event.MsgFile:
 | 
			
		||||
		msg := NewFileMessage(matrix, evt, displayname)
 | 
			
		||||
		if !matrix.Preferences().DisableDownloads {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user