mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 07:45:30 +03:00
cleanups to character colouring code
This commit is contained in:
parent
7fbab6202e
commit
9fa60138b3
@ -1364,27 +1364,23 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) {
|
||||
}
|
||||
}
|
||||
|
||||
characterColor := b.buffOpts.foreground
|
||||
|
||||
if len(colorStack) > 0 {
|
||||
var a int32
|
||||
a, colorStack = int32(colorStack[len(colorStack)-1]), colorStack[:len(colorStack)-1]
|
||||
ctx.SetColor(strife.HexRGB(a))
|
||||
} else {
|
||||
ctx.SetColor(strife.HexRGB(b.buffOpts.foreground))
|
||||
characterColor = a
|
||||
}
|
||||
|
||||
if b.HasFocus() && (b.curs.x-b.cam.x) == (x_col-1) && (b.curs.y-b.cam.y) == y_col {
|
||||
log.Println("char we are over is ", string(char))
|
||||
// if we're currently over a character then set
|
||||
// the font colour to something else
|
||||
// ONLY SET THE COLOUR IF WE HAVE FOCUS ALSO!
|
||||
// fixme!
|
||||
ctx.SetColor(strife.HexRGB(b.buffOpts.cursorInvert))
|
||||
characterColor = b.buffOpts.cursorInvert
|
||||
}
|
||||
|
||||
lineHeight := last_h + pad
|
||||
xPos := b.ex + (rx + ((x_col - 1) * last_w))
|
||||
yPos := b.ey + (ry + (y_col * lineHeight)) + halfPad
|
||||
|
||||
ctx.SetColor(strife.HexRGB(characterColor))
|
||||
last_w, last_h = ctx.String(string(char), xPos, yPos)
|
||||
|
||||
if DEBUG_MODE {
|
||||
|
Loading…
Reference in New Issue
Block a user