Skip to content

Commit

Permalink
Fix broken spacing for each row of completion area
Browse files Browse the repository at this point in the history
  • Loading branch information
raccoonback committed Aug 10, 2021
1 parent 6ee0a0f commit 0896ea1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion render.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ func (r *Render) renderCompletion(buf *Buffer, completions *CompletionManager) {
}

selected := completions.selected - completions.verticalScroll
cursorColumnSpacing := cursor

r.out.SetColor(White, Cyan, false)
for i := 0; i < windowHeight; i++ {
r.out.CursorDown(1)
alignNextLine(r, cursorColumnSpacing)

if i == selected {
r.out.SetColor(r.selectedSuggestionTextColor, r.selectedSuggestionBGColor, true)
} else {
Expand Down Expand Up @@ -286,3 +289,9 @@ func clamp(high, low, x float64) float64 {
return x
}
}

func alignNextLine(r *Render, col int) {
r.out.CursorDown(1)
r.out.WriteStr("\r")
r.out.CursorForward(col)
}

0 comments on commit 0896ea1

Please sign in to comment.