From 6ad72ecc4672aa0785c4426e03ca62f00912b4d1 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Mon, 8 Dec 2025 18:13:18 -0500 Subject: [PATCH] Shorten queue descriptions and wrap text to keep controls visible --- internal/ui/queueview.go | 1 + internal/utils/utils.go | 23 +++++++++++++++++++++++ main.go | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/internal/ui/queueview.go b/internal/ui/queueview.go index f05d512..cef592b 100644 --- a/internal/ui/queueview.go +++ b/internal/ui/queueview.go @@ -119,6 +119,7 @@ func buildJobItem( descLabel := widget.NewLabel(job.Description) descLabel.TextStyle = fyne.TextStyle{Italic: true} + descLabel.Wrapping = fyne.TextWrapWord // Progress bar (for running jobs) progress := widget.NewProgressBar() diff --git a/internal/utils/utils.go b/internal/utils/utils.go index a176503..d5eec5d 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -8,6 +8,7 @@ import ( "path/filepath" "strconv" "strings" + "unicode/utf8" "fyne.io/fyne/v2" "fyne.io/fyne/v2/widget" @@ -51,6 +52,28 @@ func FirstNonEmpty(values ...string) string { return "--" } +// ShortenMiddle shortens a string to max runes, keeping start and end with ellipsis in the middle. +func ShortenMiddle(s string, max int) string { + if max <= 0 { + return "" + } + if utf8.RuneCountInString(s) <= max { + return s + } + ellipsis := "…" + keep := max - utf8.RuneCountInString(ellipsis) + if keep <= 0 { + return s[:max] + } + left := keep / 2 + right := keep - left + runes := []rune(s) + if left+right >= len(runes) { + return s + } + return string(runes[:left]) + ellipsis + string(runes[len(runes)-right:]) +} + // Parsing utilities // ParseFloat parses a float64 from a string diff --git a/main.go b/main.go index 36d02a4..a576049 100644 --- a/main.go +++ b/main.go @@ -918,7 +918,7 @@ func (s *appState) addConvertToQueue() error { job := &queue.Job{ Type: queue.JobTypeConvert, Title: fmt.Sprintf("Convert %s", filepath.Base(src.Path)), - Description: fmt.Sprintf("Output: %s → %s", filepath.Base(src.Path), filepath.Base(outPath)), + Description: fmt.Sprintf("Output: %s → %s", utils.ShortenMiddle(filepath.Base(src.Path), 40), utils.ShortenMiddle(filepath.Base(outPath), 40)), InputFile: src.Path, OutputFile: outPath, Config: config,