aboutsummaryrefslogtreecommitdiffstats
path: root/icat.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-05-28 16:48:49 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-05-28 16:48:49 -0700
commit7c5f38d06afc4041261379ce69fa5df2442ea24e (patch)
tree696ea965e801b0b8fd0751e029737567a990f8e5 /icat.go
parent3ac0a6b87c04374777d9405e3bddc1b29f337886 (diff)
downloadimgutil-7c5f38d06afc4041261379ce69fa5df2442ea24e.tar.zst
Change to block24 mode by default
This will have better compatibility, e.g. with tmux. I also added handling for when Xpixel and Ypixel are zero.
Diffstat (limited to 'icat.go')
-rw-r--r--icat.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/icat.go b/icat.go
index a1922f1..a8768b3 100644
--- a/icat.go
+++ b/icat.go
@@ -22,7 +22,7 @@ import (
var (
x = flag.Int("x", 0, "set image width in columns")
y = flag.Int("y", 0, "set image height in rows")
- m = flagPrintMode(flag.CommandLine, "m", modeSixel, "one of 'block', 'block24', or 'sixel'")
+ m = flagPrintMode(flag.CommandLine, "m", modeBlock24, "one of 'block', 'block24', or 'sixel'")
)
type printMode int
@@ -134,6 +134,9 @@ func icat(args []string) error {
lines = int(ws.Row)
lines-- // Leave a line for the status bar.
cellX, cellY := int(ws.Xpixel)/int(ws.Col), int(ws.Ypixel)/int(ws.Row)
+ if cellX == 0 && cellY == 0 {
+ cellX, cellY = 10, 20
+ }
if *m == modeSixel {
cols *= cellX
lines *= cellY