Skip to content

Commit 832212f

Browse files
committed
Fixed a problem in which specifying columns would result in one column less than the specified size.
1 parent cbf44b1 commit 832212f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

editor/scrollbar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type ScrollBar struct {
2727
func newScrollBar() *ScrollBar {
2828
widget := widgets.NewQWidget(nil, 0)
2929
widget.SetContentsMargins(0, 0, 0, 0)
30-
widget.SetFixedWidth(10)
30+
widget.SetFixedWidth(editor.config.ScrollBar.Width)
3131
thumb := widgets.NewQWidget(widget, 0)
3232
thumb.SetFixedWidth(8)
3333

editor/workspace.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ func (ws *Workspace) updateSize() (windowWidth, windowHeight, cols, rows int) {
738738

739739
geometry := e.window.Geometry()
740740
width := geometry.Width()
741+
741742
marginWidth := e.window.BorderSize()*4 + e.window.WindowGap()*2
742743
sideWidth := 0
743744
if e.side != nil {
@@ -783,7 +784,7 @@ func (ws *Workspace) updateSize() (windowWidth, windowHeight, cols, rows int) {
783784
screenWidth := width - scrollbarWidth - minimapWidth
784785
screenHeight := height - tablineHeight
785786

786-
rw := int(screenWidth) % int(ws.screen.font.cellwidth)
787+
rw := screenWidth - int(math.Ceil(float64(int(float64(screenWidth)/ws.screen.font.cellwidth))*ws.screen.font.cellwidth))
787788
rh := screenHeight % ws.screen.font.lineHeight
788789
screenWidth -= rw
789790
screenHeight -= rh
@@ -836,7 +837,7 @@ func (ws *Workspace) updateApplicationWindowSize(cols, rows int) {
836837
return
837838
}
838839

839-
appWinWidth := int(font.cellwidth * float64(cols))
840+
appWinWidth := int(math.Ceil(font.cellwidth * float64(cols)))
840841
appWinHeight := int(float64(font.lineHeight) * float64(rows))
841842

842843
marginWidth := e.window.BorderSize()*4 + e.window.WindowGap()*2

0 commit comments

Comments
 (0)