Skip to content

Commit fd39902

Browse files
committed
fix table rendering issues in Windows Terminal
1 parent 5535e58 commit fd39902

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/util/term/fb.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func (fb FrameBuffer) Write(p []byte) (int, error) {
7676
return 0, nil
7777
}
7878

79-
rows := int(bufferInfo.size.y)
80-
cols := int(bufferInfo.size.x)
79+
rows := int(bufferInfo.rect.bottom)
80+
cols := int(bufferInfo.rect.right)
8181

8282
chars := make([]charInfo, cols*rows)
8383

@@ -132,6 +132,7 @@ func (fb FrameBuffer) Write(p []byte) (int, error) {
132132

133133
// clear the current frame buffer screen
134134
fb.cls(bufferInfo)
135+
135136
// the following block of code does the heavy lifting of writing the
136137
// character buffer to the screen frame buffer that we previously created
137138
cord := point{}
@@ -145,7 +146,7 @@ func (fb FrameBuffer) Write(p []byte) (int, error) {
145146
uintptr(unsafe.Pointer(&rect)),
146147
)
147148

148-
return 0, nil
149+
return len(p), nil
149150
}
150151

151152
// Close closes this frame buffer.

pkg/util/term/term.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type consoleScreenBufferInfo struct {
6262
size point
6363
_ point
6464
attributes uint16
65-
_ rect
65+
rect rect
6666
_ point
6767
}
6868

@@ -87,7 +87,7 @@ func GetColumns() int {
8787
if err != nil {
8888
return 0
8989
}
90-
return int(bufferInfo.size.x)
90+
return int(bufferInfo.rect.right)
9191
}
9292

9393
// showCursor shows/hides the cursor.

0 commit comments

Comments
 (0)