From 92e9060bcd41cd177fe58ba60328201b004c0925 Mon Sep 17 00:00:00 2001 From: Dmitry Maluka Date: Sun, 18 Oct 2020 02:48:39 +0200 Subject: [PATCH] Fix suggestions display (#1825) Fix the following bugs: - If a split pane is not at the left edge of the screen, the statusline with suggestions for it is displayed at wrong place. - When keymenu is enabled, the statusline with suggestions is not displayed at all. --- internal/display/statusline.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/display/statusline.go b/internal/display/statusline.go index 5c5f5512..b94acdef 100644 --- a/internal/display/statusline.go +++ b/internal/display/statusline.go @@ -98,6 +98,8 @@ func (s *StatusLine) Display() { // We'll draw the line at the lowest line in the window y := s.win.Height + s.win.Y - 1 + winX := s.win.X + b := s.win.Buf // autocomplete suggestions (for the buffer, not for the infowindow) if b.HasSuggestions && len(b.Suggestions) > 1 { @@ -105,10 +107,6 @@ func (s *StatusLine) Display() { if style, ok := config.Colorscheme["statusline"]; ok { statusLineStyle = style } - keymenuOffset := 0 - if config.GetGlobalOption("keymenu").(bool) { - keymenuOffset = len(keydisplay) - } x := 0 for j, sug := range b.Suggestions { style := statusLineStyle @@ -116,13 +114,13 @@ func (s *StatusLine) Display() { style = style.Reverse(true) } for _, r := range sug { - screen.SetContent(x, y-keymenuOffset, r, nil, style) + screen.SetContent(winX+x, y, r, nil, style) x++ if x >= s.win.Width { return } } - screen.SetContent(x, y-keymenuOffset, ' ', nil, statusLineStyle) + screen.SetContent(winX+x, y, ' ', nil, statusLineStyle) x++ if x >= s.win.Width { return @@ -130,7 +128,7 @@ func (s *StatusLine) Display() { } for x < s.win.Width { - screen.SetContent(x, y-keymenuOffset, ' ', nil, statusLineStyle) + screen.SetContent(winX+x, y, ' ', nil, statusLineStyle) x++ } return @@ -170,7 +168,6 @@ func (s *StatusLine) Display() { leftLen := util.StringWidth(leftText, util.CharacterCount(leftText), 1) rightLen := util.StringWidth(rightText, util.CharacterCount(rightText), 1) - winX := s.win.X for x := 0; x < s.win.Width; x++ { if x < leftLen { r, combc, size := util.DecodeCharacter(leftText)