File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -64,13 +64,15 @@ func Restore(fd int, state *State) error {
64
64
return windows .SetConsoleMode (windows .Handle (fd ), state .mode )
65
65
}
66
66
67
- // GetSize returns the dimensions of the given terminal.
67
+ // GetSize returns the visible dimensions of the given terminal.
68
+ //
69
+ // These dimensions don't include any scrollback buffer height.
68
70
func GetSize (fd int ) (width , height int , err error ) {
69
71
var info windows.ConsoleScreenBufferInfo
70
72
if err := windows .GetConsoleScreenBufferInfo (windows .Handle (fd ), & info ); err != nil {
71
73
return 0 , 0 , err
72
74
}
73
- return int (info .Size . X ), int (info .Size . Y ), nil
75
+ return int (info .Window . Right - info . Window . Left + 1 ), int (info .Window . Bottom - info . Window . Top + 1 ), nil
74
76
}
75
77
76
78
// ReadPassword reads a line of input from a terminal without local echo. This
You can’t perform that action at this time.
0 commit comments