Skip to content

Commit

Permalink
Fixing term module for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
FlUxIuS committed Aug 1, 2024
1 parent 39ea602 commit 94ebc23
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions go/rfswift/dock/terminal_windows.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package dock

import (
"github.com/Azure/go-ansiterm/winterm"
"golang.org/x/sys/windows"
)

func getTerminalSize(fd int) (int, int, error) {
var info winterm.CONSOLE_SCREEN_BUFFER_INFO
handle := winterm.GetStdHandle(winterm.STD_OUTPUT_HANDLE)
err := winterm.GetConsoleScreenBufferInfo(handle, &info)
hOut, err := windows.GetStdHandle(windows.STD_OUTPUT_HANDLE)
if err != nil {
return 0, 0, err
}

var info windows.ConsoleScreenBufferInfo
err = windows.GetConsoleScreenBufferInfo(hOut, &info)
if err != nil {
return 0, 0, err
}

width := int(info.Window.Right - info.Window.Left + 1)
height := int(info.Window.Bottom - info.Window.Top + 1)
return width, height, nil
}
}

0 comments on commit 94ebc23

Please sign in to comment.