From 02b3930ef99feb9238a53f13c84b274cfd939ccf Mon Sep 17 00:00:00 2001 From: piotr Date: Mon, 16 May 2022 01:01:25 +0200 Subject: [PATCH 1/2] trim string, not runes #62 --- uicomponents.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uicomponents.go b/uicomponents.go index 011ad7f..5b8a567 100644 --- a/uicomponents.go +++ b/uicomponents.go @@ -259,8 +259,8 @@ func flowBoxButton(entry desktopEntry) *gtk.Button { terminal := entry.Terminal desc := entry.CommentLoc if len(desc) > 120 { - r := []rune(desc) - desc = string(r[:117]) + r := []rune(desc[:117]) + desc = string(r) desc = fmt.Sprintf("%s…", desc) } button.Connect("button-release-event", func(btn *gtk.Button, e *gdk.Event) bool { From 7230d82be36cf577e2616707f5b1c6c0a25aae7d Mon Sep 17 00:00:00 2001 From: piotr Date: Mon, 16 May 2022 01:16:02 +0200 Subject: [PATCH 2/2] fix trimming names as well #62 --- main.go | 2 +- uicomponents.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 7488b20..29be04b 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ import ( "github.com/gotk3/gotk3/gtk" ) -const version = "0.3.0" +const version = "0.3.1" var ( appDirs []string diff --git a/uicomponents.go b/uicomponents.go index 5b8a567..f5bcb24 100644 --- a/uicomponents.go +++ b/uicomponents.go @@ -248,8 +248,8 @@ func flowBoxButton(entry desktopEntry) *gtk.Button { button.SetImagePosition(gtk.POS_TOP) name := entry.NameLoc if len(name) > 20 { - r := []rune(name) - name = string(r[:17]) + r := []rune(name[:17]) + name = string(r) name = fmt.Sprintf("%s…", name) } button.SetLabel(name)