Skip to content

Commit

Permalink
Merge pull request #5 from raccoonback/fix/support-emoji
Browse files Browse the repository at this point in the history
Fix/support emoji
  • Loading branch information
Verseth authored Jul 1, 2023
2 parents f870e62 + 0896ea1 commit ac65f23
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion render.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (r *Render) getCurrentPrefix() string {

func (r *Render) renderPrefix() {
r.out.SetColor(r.prefixTextColor, r.prefixBGColor, false)
r.out.WriteStr("\r")
r.out.WriteStr(r.getCurrentPrefix())
r.out.SetColor(DefaultColor, DefaultColor, false)
}
Expand Down Expand Up @@ -130,9 +131,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 @@ -338,3 +342,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 ac65f23

Please sign in to comment.