Making use of the baller ass new highlighting style

This commit is contained in:
Sasha Koshka 2022-11-29 03:08:28 -05:00
parent 080b5ffd43
commit 007cf34c56
5 changed files with 17 additions and 9 deletions

View File

@ -60,8 +60,10 @@ func drawInput () {
if character == '_' {
application.SetColor(x + xOffset, y, stone.ColorDim)
application.SetStyle(x + xOffset, y, stone.StyleNormal)
} else {
application.SetColor(x + xOffset, y, cell.Color())
application.SetStyle(x + xOffset, y, cell.Style())
}
}
}

2
go.mod
View File

@ -2,7 +2,7 @@ module git.tebibyte.media/sashakoshka/mathpan
go 1.19
require git.tebibyte.media/sashakoshka/stone v0.2.1
require git.tebibyte.media/sashakoshka/stone v0.5.1
require (
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 // indirect

4
go.sum
View File

@ -1,5 +1,5 @@
git.tebibyte.media/sashakoshka/stone v0.2.1 h1:qUvuYpl0yN2bY50vXazvH2s6EMvk8IFgvr8QiiA8xvc=
git.tebibyte.media/sashakoshka/stone v0.2.1/go.mod h1:ISnqmX6xvItOot3eW3YWLcNFeJrGpKetQGQniAjnU2A=
git.tebibyte.media/sashakoshka/stone v0.5.1 h1:QQo1lccq6bMebXRKlbAoFBKSDbVwvSkXriKHMGvfAkk=
git.tebibyte.media/sashakoshka/stone v0.5.1/go.mod h1:ISnqmX6xvItOot3eW3YWLcNFeJrGpKetQGQniAjnU2A=
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 h1:1qlsVAQJXZHsaM8b6OLVo6muQUQd4CwkH/D3fnnbHXA=
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ=
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 h1:lTG4HQym5oPKjL7nGs+csTgiDna685ZXjxijkne828g=

Binary file not shown.

18
tree.go
View File

@ -232,19 +232,22 @@ func (operation *Operation) Render (target stone.Buffer, offset int) (moved int)
}
if selectedExpression == operation {
target.SetColor(offset, 0, stone.ColorBlue)
target.SetColor(offset, 0, stone.ColorYellow)
target.SetStyle(offset, 0, stone.StyleHighlight)
} else {
target.SetColor(offset, 0, stone.ColorDim)
target.SetStyle(offset, 0, stone.StyleNormal)
}
moved ++
opcodeSymbol := operation.opcode.String()
for _, character := range opcodeSymbol {
target.SetRune(offset + moved, 0, character)
target.SetColor(offset + moved, 0, stone.ColorYellow)
if selectedExpression == operation {
target.SetColor(offset + moved, 0, stone.ColorBlue)
target.SetStyle(offset + moved, 0, stone.StyleHighlight)
} else {
target.SetColor(offset + moved, 0, stone.ColorYellow)
target.SetStyle(offset + moved, 0, stone.StyleNormal)
}
moved ++
}
@ -262,9 +265,11 @@ func (operation *Operation) Render (target stone.Buffer, offset int) (moved int)
}
if selectedExpression == operation {
target.SetColor(offset + moved, 0, stone.ColorBlue)
target.SetColor(offset + moved, 0, stone.ColorYellow)
target.SetStyle(offset + moved, 0, stone.StyleHighlight)
} else {
target.SetColor(offset + moved, 0, stone.ColorDim)
target.SetStyle(offset + moved, 0, stone.StyleNormal)
}
moved ++
return
@ -362,10 +367,11 @@ func (literal *IntegerLiteral) Render (target stone.Buffer, offset int) (moved i
for _, character := range output {
target.SetRune(offset + moved, 0, character)
target.SetColor(offset + moved, 0, stone.ColorPurple)
if selectedExpression == literal {
target.SetColor(offset + moved, 0, stone.ColorBlue)
target.SetStyle(offset + moved, 0, stone.StyleHighlight)
} else {
target.SetColor(offset + moved, 0, stone.ColorPurple)
target.SetStyle(offset + moved, 0, stone.StyleNormal)
}
moved ++
}