From f3b3635bd8950e1accb5dbbcaf311c8c7a26a856 Mon Sep 17 00:00:00 2001 From: piotr Date: Sun, 8 May 2022 01:43:16 +0200 Subject: [PATCH] trim comments > 120 chars #61 --- main.go | 2 +- uicomponents.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index a515335..7488b20 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ import ( "github.com/gotk3/gotk3/gtk" ) -const version = "0.2.9" +const version = "0.3.0" var ( appDirs []string diff --git a/uicomponents.go b/uicomponents.go index 2e08be7..011ad7f 100644 --- a/uicomponents.go +++ b/uicomponents.go @@ -258,6 +258,11 @@ func flowBoxButton(entry desktopEntry) *gtk.Button { exec := entry.Exec terminal := entry.Terminal desc := entry.CommentLoc + if len(desc) > 120 { + r := []rune(desc) + desc = string(r[:117]) + desc = fmt.Sprintf("%s…", desc) + } button.Connect("button-release-event", func(btn *gtk.Button, e *gdk.Event) bool { btnEvent := gdk.EventButtonNewFromEvent(e) if btnEvent.Button() == 1 {