From 9fa60138b3d2c767b04748b8cd75d2ef0c774388 Mon Sep 17 00:00:00 2001 From: Felix Angell Date: Sat, 19 May 2018 13:04:57 +0100 Subject: [PATCH] cleanups to character colouring code --- gui/buffer.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/gui/buffer.go b/gui/buffer.go index 99875ff..6c85550 100644 --- a/gui/buffer.go +++ b/gui/buffer.go @@ -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 {