aboutsummaryrefslogtreecommitdiffstats
path: root/thumbnailer.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-05-27 21:29:41 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-05-27 21:29:41 -0700
commit66c5a631cc2b64b604cf0c714c12eb4648cbf285 (patch)
tree89a206a73a1305a626424d323ebab55ccc3a7f37 /thumbnailer.go
parentc8b1bb3dd21257c5fd782a1aaf96eca0ee4fef45 (diff)
downloadimgutil-66c5a631cc2b64b604cf0c714c12eb4648cbf285.tar.zst
Fix newlines
Diffstat (limited to 'thumbnailer.go')
-rw-r--r--thumbnailer.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/thumbnailer.go b/thumbnailer.go
index 40fb525..2cd80e9 100644
--- a/thumbnailer.go
+++ b/thumbnailer.go
@@ -114,12 +114,7 @@ type img struct {
}
func compositeImages(w io.Writer, images []img, imageWidth, imagesPerRow int) {
- firstRow := true
for row := range slices.Chunk(images, imagesPerRow) {
- if !firstRow {
- fmt.Fprintln(w)
- }
- firstRow = false
rowLines := make([][]string, len(row))
names := make([][]string, len(row))
for i, img := range row {
@@ -229,8 +224,14 @@ func thumbnailer(args []string) error {
if err := thumbnailFiles(w, cols, lines, imagesPerRow, files); err != nil {
return err
}
- for _, d := range dirs {
- fmt.Fprintf(w, "\n%s:\n", d)
+ if len(files) > 0 && len(dirs) > 0 {
+ fmt.Fprintln(w)
+ }
+ for i, d := range dirs {
+ if i > 0 {
+ fmt.Fprintln(w)
+ }
+ fmt.Fprintf(w, "%s:\n", d)
dirFiles, err := readDir(d)
if err != nil {
return err