From 955bde4abc938c4c77ac1d37125f53ae6a3ff6b0 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sun, 5 Jan 2020 15:02:52 -0500 Subject: [PATCH] Minor view fix --- internal/display/bufwindow.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/display/bufwindow.go b/internal/display/bufwindow.go index 66ed3be7..21bf8bfa 100644 --- a/internal/display/bufwindow.go +++ b/internal/display/bufwindow.go @@ -188,6 +188,11 @@ func (w *BufWindow) LocFromVisual(svloc buffer.Loc) buffer.Loc { bufHeight-- } + bufWidth := w.Width + if w.Buf.Settings["scrollbar"].(bool) && w.Buf.LinesNum() > w.Height { + bufWidth-- + } + // We need to know the string length of the largest line number // so we can pad appropriately when displaying line numbers maxLineNumLength := len(strconv.Itoa(b.LinesNum())) @@ -259,7 +264,7 @@ func (w *BufWindow) LocFromVisual(svloc buffer.Loc) buffer.Loc { totalwidth += width // If we reach the end of the window then we either stop or we wrap for softwrap - if vloc.X >= w.Width { + if vloc.X >= bufWidth { if !softwrap { break } else { @@ -594,7 +599,9 @@ func (w *BufWindow) displayBuffer() { screen.SetContent(i+w.X, vloc.Y+w.Y, ' ', nil, curStyle) } - draw(' ', curStyle, true) + if vloc.X != bufWidth { + draw(' ', curStyle, true) + } bloc.X = w.StartCol bloc.Y++