Skip to content

Commit 158e972

Browse files
authored
Merge pull request #3 from hilli/compile-on-windows
Make it compile on windows
2 parents 690dcf0 + 63e1397 commit 158e972

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

print_image.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ func PrintImage(img *image.Image, filename string, imageSize int64) error {
7777
img2 = resize.Resize(uint(size), 0, img2, resize.NearestNeighbor)
7878
case 'y':
7979
img2 = resize.Resize(0, uint(size), img2, resize.NearestNeighbor)
80+
case '0':
81+
// Do nothing
8082
}
8183

8284
newWidth := img2.Bounds().Max.X

resize_constraints.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ func resizeConstraints(imageBounds image.Rectangle, maxHeight, maxWidth int) (si
88
imgHeight := imageBounds.Dy()
99
imgWidth := imageBounds.Dx()
1010

11+
if maxHeight == 0 || maxWidth == 0 {
12+
return 0, '0' // Don't resize
13+
}
14+
1115
if imgHeight <= maxHeight && imgWidth <= maxWidth {
1216
return 0, '0' // Don't resize
1317
}

termsize.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build !windows
2+
// +build !windows
3+
14
package icat
25

36
import (

termsize_windows.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//go:build windows
2+
// +build windows
3+
4+
package icat
5+
6+
// TermSize returns the size of the terminal in rows and columns, as well as the pixel width and height.
7+
// This is not supported on Windows.
8+
// If the terminal size cannot be determined, it returns (0, 0, 0, 0).
9+
func TermSize() (rows, columns, pixelWith, pixelHeight uint16) {
10+
return 0, 0, 0, 0
11+
}

0 commit comments

Comments
 (0)