diff options
Diffstat (limited to 'internal/tui')
| -rw-r--r-- | internal/tui/tui.go | 6 | ||||
| -rw-r--r-- | internal/tui/tui_test.go | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 96bb728..c9f1241 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -36,9 +36,9 @@ func Colour(w io.Writer) bool { return !noColour } -// Height is the terminal's row count, 0 when it is not a terminal or the +// height is the terminal's row count, 0 when it is not a terminal or the // size cannot be read. -func Height(w io.Writer) int { +func height(w io.Writer) int { f, ok := w.(*os.File) if !ok || !isTerminal(int(f.Fd())) { return 0 @@ -73,7 +73,7 @@ func Page(w io.Writer, text string) error { // the terminal the pager would inherit, not the writer text is otherwise // sent to. func fitsWithoutPaging(text string) bool { - h := Height(os.Stdout) + h := height(os.Stdout) if h <= 0 { return true } diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go index 6918859..a3640ac 100644 --- a/internal/tui/tui_test.go +++ b/internal/tui/tui_test.go @@ -37,8 +37,8 @@ func TestColourNeedsTerminalAndNoNOCOLOR(t *testing.T) { func TestHeight(t *testing.T) { var buf bytes.Buffer - if h := Height(&buf); h != 0 { - t.Errorf("Height on a non-terminal writer = %d, want 0", h) + if h := height(&buf); h != 0 { + t.Errorf("height on a non-terminal writer = %d, want 0", h) } oldT, oldS := isTerminal, termSize @@ -46,8 +46,8 @@ func TestHeight(t *testing.T) { isTerminal = func(fd int) bool { return true } termSize = func(fd int) (int, int, error) { return 80, 24, nil } - if h := Height(os.Stdout); h != 24 { - t.Errorf("Height = %d, want 24", h) + if h := height(os.Stdout); h != 24 { + t.Errorf("height = %d, want 24", h) } } |
