mirror of
https://github.com/diamondburned/cchat-gtk.git
synced 2024-11-01 03:54:16 +00:00
diamondburned (Forefront)
f10aa71003
This commit refactors the input container's UI as well as fixing some bugs related to asynchronous fetching of images. It also adds complete typing indicator capabilities, all without using a single mutex!
30 lines
583 B
Go
30 lines
583 B
Go
package rich
|
|
|
|
import (
|
|
"html"
|
|
|
|
"github.com/diamondburned/cchat/text"
|
|
)
|
|
|
|
func Small(text string) string {
|
|
return `<span size="small" color="#808080">` + text + "</span>"
|
|
}
|
|
|
|
func MakeRed(content text.Rich) string {
|
|
return `<span color="red">` + html.EscapeString(content.Content) + `</span>`
|
|
}
|
|
|
|
// used for grabbing text without changing state
|
|
type nullLabel struct {
|
|
text.Rich
|
|
}
|
|
|
|
func (n *nullLabel) SetLabel(t text.Rich) { n.Rich = t }
|
|
|
|
// used for grabbing url without changing state
|
|
type nullIcon struct {
|
|
url string
|
|
}
|
|
|
|
func (i *nullIcon) SetIcon(url string) { i.url = url }
|