From 0896ea16b3ccdbb96e54c4f88788497f2704b2bd Mon Sep 17 00:00:00 2001 From: KOSEUNGBIN Date: Wed, 11 Aug 2021 01:04:50 +0900 Subject: [PATCH] Fix broken spacing for each row of completion area --- render.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/render.go b/render.go index 64d7d055..d165d74f 100644 --- a/render.go +++ b/render.go @@ -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 { @@ -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) +}