Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Go terminal size

[![GoDoc](https://godoc.org/github.com/kopoli/go-terminal-size?status.svg)](https://godoc.org/github.com/kopoli/go-terminal-size)
[![Build Status](https://travis-ci.org/kopoli/go-terminal-size.svg?branch=master)](https://travis-ci.org/kopoli/go-terminal-size)
[![Go Report Card](https://goreportcard.com/badge/github.com/kopoli/go-terminal-size)](https://goreportcard.com/report/github.com/kopoli/go-terminal-size)
[![GoDoc](https://godoc.org/github.com/abakum/go-terminal-size?status.svg)](https://godoc.org/github.com/abakum/go-terminal-size)
[![Build Status](https://travis-ci.org/abakum/go-terminal-size.svg?branch=master)](https://travis-ci.org/abakum/go-terminal-size)
[![Go Report Card](https://goreportcard.com/badge/github.com/abakum/go-terminal-size)](https://goreportcard.com/report/github.com/abakum/go-terminal-size)

Features:
- Get the size of the current terminal as rows and columns.
Expand All @@ -12,7 +12,7 @@ Features:
## Installation

```
$ go get github.com/kopoli/go-terminal-size
$ go get github.com/abakum/go-terminal-size
```

## Usage
Expand All @@ -26,7 +26,7 @@ package main
import (
"fmt"

tsize "github.com/kopoli/go-terminal-size"
tsize "github.com/abakum/go-terminal-size"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

tsize "github.com/kopoli/go-terminal-size"
tsize "github.com/abakum/go-terminal-size"
)

func printSize(s tsize.Size) {
Expand Down
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/abakum/go-terminal-size

go 1.21

require (
github.com/mattn/go-isatty v0.0.20
golang.org/x/sys v0.27.0
)
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
5 changes: 3 additions & 2 deletions size_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

package tsize
Expand Down Expand Up @@ -72,8 +73,8 @@ func getTerminalSize(fp *os.File) (s Size, err error) {

err = nil
s = Size{
Width: int(csbi.size.x),
Height: int(csbi.size.y),
Width: int(csbi.window.right - csbi.window.left + 1),
Height: int(csbi.window.bottom - csbi.window.top + 1),
}

return
Expand Down