toml stuff

This commit is contained in:
Felix Angell 2018-04-22 18:38:01 +01:00
parent b654a4918d
commit f1c4edfec4
3 changed files with 23 additions and 1 deletions

View File

@ -21,6 +21,9 @@ always_render = true
syntax_highlighting = true
[file_associations]
[file_associations.toml]
extensions = [".toml"]
[file_associations.c]
extensions = [".c", ".h", ".cc"]

View File

@ -13,6 +13,21 @@ func RegisterSyntax(name string, s string) {
}
func init() {
// TOML
RegisterSyntax("toml", `[syntax.toml]
[syntax.declaration]
colouring = 0xf8f273
pattern = '(\[)(.*)(\])'
[syntax.identifier]
colouring = 0xf0a400
pattern = '\b([a-z]|[A-Z])+(_|([a-z]|[A-Z])+)*\b'
[syntax.symbol]
match = "="
colouring = 0xf8f273
`)
// C LANGUAGE SYNTAX HIGHLIGHTING
RegisterSyntax("c", `[syntax.c]

View File

@ -833,7 +833,11 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) {
if b.cfg.Editor.Highlight_Line && b.HasFocus {
ctx.SetColor(strife.Black) // highlight_line_col?
ctx.Rect(ex+rx, ey+(ry+b.curs.ry*last_h)-(b.cam.y*last_h), b.w, last_h, strife.Fill)
highlightLinePosY := ey + (ry + b.curs.ry*last_h) - (b.cam.y * last_h)
highlightLinePosX := ex + rx
ctx.Rect(highlightLinePosX, highlightLinePosY, b.w, last_h, strife.Fill)
}
// render the ol' cursor