Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 8652dd3

Browse files
committed
Remove unnecessary font calls
1 parent 7fae670 commit 8652dd3

2 files changed

Lines changed: 2 additions & 24 deletions

File tree

pkg/term/term_windows.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,11 @@ func GetWinsize(fd uintptr) (*Winsize, error) {
5252
return nil, err
5353
}
5454

55-
font, err := winterm.GetCurrentConsoleFont(fd)
56-
if err != nil {
57-
return nil, err
58-
}
59-
6055
winsize := &Winsize{
6156
Width: uint16(info.Window.Right - info.Window.Left + 1),
6257
Height: uint16(info.Window.Bottom - info.Window.Top + 1),
63-
x: uint16(font.FontSize.X),
64-
y: uint16(font.FontSize.Y)}
58+
x: 0,
59+
y: 0}
6560

6661
// Note: GetWinsize is called frequently -- uncomment only for excessive details
6762
// logrus.Debugf("[windows] GetWinsize: Console(%v)", info.String())

vendor/src/github.com/Azure/go-ansiterm/winterm/api.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ var (
4040
scrollConsoleScreenBufferProc = kernel32DLL.NewProc("ScrollConsoleScreenBufferA")
4141
setConsoleTextAttributeProc = kernel32DLL.NewProc("SetConsoleTextAttribute")
4242
setConsoleWindowInfoProc = kernel32DLL.NewProc("SetConsoleWindowInfo")
43-
getCurrentConsoleFontProc = kernel32DLL.NewProc("GetCurrentConsoleFont")
4443
writeConsoleOutputProc = kernel32DLL.NewProc("WriteConsoleOutputW")
4544
readConsoleInputProc = kernel32DLL.NewProc("ReadConsoleInputW")
4645
waitForSingleObjectProc = kernel32DLL.NewProc("WaitForSingleObject")
@@ -125,11 +124,6 @@ type (
125124
Visible BOOL
126125
}
127126

128-
CONSOLE_FONT_INFO struct {
129-
Font DWORD
130-
FontSize COORD
131-
}
132-
133127
CONSOLE_SCREEN_BUFFER_INFO struct {
134128
Size COORD
135129
CursorPosition COORD
@@ -264,17 +258,6 @@ func SetConsoleWindowInfo(handle uintptr, isAbsolute bool, rect SMALL_RECT) erro
264258
return checkError(r1, r2, err)
265259
}
266260

267-
// GetCurrentConsoleFont retrieves the pixel dimensions of the font for the current window.
268-
// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms683176(v=vs.85).aspx.
269-
func GetCurrentConsoleFont(handle uintptr) (*CONSOLE_FONT_INFO, error) {
270-
info := CONSOLE_FONT_INFO{}
271-
err := checkError(getCurrentConsoleFontProc.Call(handle, uintptr(BOOL(0)), uintptr(unsafe.Pointer(&info))))
272-
if err != nil {
273-
return nil, err
274-
}
275-
return &info, nil
276-
}
277-
278261
// WriteConsoleOutput writes the CHAR_INFOs from the provided buffer to the active console buffer.
279262
// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms687404(v=vs.85).aspx.
280263
func WriteConsoleOutput(handle uintptr, buffer []CHAR_INFO, bufferSize COORD, bufferCoord COORD, writeRegion *SMALL_RECT) error {

0 commit comments

Comments
 (0)