diff --git a/internal/c/gtkp/gtkp.go b/internal/c/gtkp/gtkp.go deleted file mode 100644 index e5a1942..0000000 --- a/internal/c/gtkp/gtkp.go +++ /dev/null @@ -1,23 +0,0 @@ -package gtkp - -// #cgo pkg-config: gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0 -// #include -// #include -// #include -import "C" - -import ( - "unsafe" - - "github.com/gotk3/gotk3/gtk" -) - -func LabelNoHyphens(l *gtk.Label) { - attrlist := C.pango_attr_list_new() - defer C.pango_attr_list_unref(attrlist) - - C.pango_attr_list_insert(attrlist, C.pango_attr_insert_hyphens_new(C.FALSE)) - - v := (*C.GtkLabel)(unsafe.Pointer(l.Native())) - C.gtk_label_set_attributes(v, attrlist) -} diff --git a/internal/ui/messages/message/message.go b/internal/ui/messages/message/message.go index 933b742..c412eee 100644 --- a/internal/ui/messages/message/message.go +++ b/internal/ui/messages/message/message.go @@ -4,6 +4,7 @@ import ( "time" "github.com/diamondburned/cchat" + "github.com/diamondburned/cchat-gtk/internal/c/labelutils" "github.com/diamondburned/cchat-gtk/internal/humanize" "github.com/diamondburned/cchat-gtk/internal/ui/imgview" "github.com/diamondburned/cchat-gtk/internal/ui/primitives" @@ -100,6 +101,9 @@ func NewEmptyContainer() *GenericContainer { content.SetSelectable(true) content.Show() + // Never insert hyphens on line breaks in the message content. + labelutils.AddAttr(content, labelutils.InsertHyphens(false)) + // Add CSS classes. primitives.AddClass(ts, "message-time") primitives.AddClass(user, "message-author")