docs: add comments about a width of the scrollbar

This commit is contained in:
Nao YONASHIRO 2018-02-12 18:51:27 +09:00
parent d3c627faf4
commit 63f3b83828

@ -101,12 +101,13 @@ func (r *Render) renderCompletion(buf *Buffer, completions *CompletionManager) {
formatted, width := formatSuggestions( formatted, width := formatSuggestions(
suggestions, suggestions,
int(r.col)-len(r.prefix)-1, int(r.col)-len(r.prefix)-1, // -1 means a width of scrollbar
) )
formatted = formatted[completions.verticalScroll : completions.verticalScroll+windowHeight] formatted = formatted[completions.verticalScroll : completions.verticalScroll+windowHeight]
l := len(formatted) l := len(formatted)
r.prepareArea(windowHeight) r.prepareArea(windowHeight)
// +1 means a width of scrollbar.
d := (len(r.prefix) + len(buf.Document().TextBeforeCursor()) + 1) % int(r.col) d := (len(r.prefix) + len(buf.Document().TextBeforeCursor()) + 1) % int(r.col)
if d == 0 { // the cursor is on right end. if d == 0 { // the cursor is on right end.
r.out.CursorBackward(width) r.out.CursorBackward(width)
@ -139,6 +140,7 @@ func (r *Render) renderCompletion(buf *Buffer, completions *CompletionManager) {
r.out.SetColor(DefaultColor, r.scrollbarBGColor, false) r.out.SetColor(DefaultColor, r.scrollbarBGColor, false)
} }
r.out.WriteStr(" ") r.out.WriteStr(" ")
// +1 means a width of scrollbar.
r.out.CursorBackward(width + 1) r.out.CursorBackward(width + 1)
} }
if d == 0 { // the cursor is on right end. if d == 0 { // the cursor is on right end.