mirror of
https://github.com/felixangell/phi.git
synced 2024-10-26 09:08:24 +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 {
|
if len(colorStack) > 0 {
|
||||||
var a int32
|
var a int32
|
||||||
a, colorStack = int32(colorStack[len(colorStack)-1]), colorStack[:len(colorStack)-1]
|
a, colorStack = int32(colorStack[len(colorStack)-1]), colorStack[:len(colorStack)-1]
|
||||||
ctx.SetColor(strife.HexRGB(a))
|
characterColor = a
|
||||||
} else {
|
|
||||||
ctx.SetColor(strife.HexRGB(b.buffOpts.foreground))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.HasFocus() && (b.curs.x-b.cam.x) == (x_col-1) && (b.curs.y-b.cam.y) == y_col {
|
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))
|
characterColor = b.buffOpts.cursorInvert
|
||||||
// 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))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lineHeight := last_h + pad
|
lineHeight := last_h + pad
|
||||||
xPos := b.ex + (rx + ((x_col - 1) * last_w))
|
xPos := b.ex + (rx + ((x_col - 1) * last_w))
|
||||||
yPos := b.ey + (ry + (y_col * lineHeight)) + halfPad
|
yPos := b.ey + (ry + (y_col * lineHeight)) + halfPad
|
||||||
|
|
||||||
|
ctx.SetColor(strife.HexRGB(characterColor))
|
||||||
last_w, last_h = ctx.String(string(char), xPos, yPos)
|
last_w, last_h = ctx.String(string(char), xPos, yPos)
|
||||||
|
|
||||||
if DEBUG_MODE {
|
if DEBUG_MODE {
|
||||||
|
Loading…
Reference in New Issue
Block a user