fix(readline): use invert for completion highlight instead of hardcoded colors

pull/143/head
TorchedSammy 2022-04-17 23:39:53 -04:00
parent 919a52a630
commit 4e8aa7ed1d
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
5 changed files with 5 additions and 3 deletions

1
api.go
View File

@ -325,6 +325,7 @@ func hlprompt(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return nil, err
}
typ := "left"
// optional 2nd arg
if len(c.Etc()) != 0 {
ltyp := c.Etc()[0]
var ok bool

View File

@ -85,6 +85,7 @@ const (
seqBold = "\x1b[1m"
seqUnderscore = "\x1b[4m"
seqBlink = "\x1b[5m"
seqInvert = "\x1b[7m"
)
// Text colours

View File

@ -121,7 +121,7 @@ func (g *CompletionGroup) writeGrid(rl *Instance) (comp string) {
}
if (x == g.tcPosX && y == g.tcPosY) && (g.isCurrent) {
comp += seqCtermFg255 + seqFgBlackBright
comp += seqInvert
}
comp += fmt.Sprintf("%-"+cellWidth+"s %s", g.Suggestions[i], seqReset)

View File

@ -188,7 +188,7 @@ func (g *CompletionGroup) writeList(rl *Instance) (comp string) {
// function highlights the cell depending on current selector place.
highlight := func(y int, x int) string {
if y == g.tcPosY && x == g.tcPosX && g.isCurrent {
return seqCtermFg255 + seqFgBlackBright
return seqInvert
}
return ""
}

View File

@ -101,7 +101,7 @@ func (g *CompletionGroup) writeMap(rl *Instance) (comp string) {
// Highlighting function
highlight := func(y int) string {
if y == g.tcPosY && g.isCurrent {
return seqCtermFg255 + seqFgBlackBright
return seqInvert
}
return ""
}