Add simple syntax highlighting

This commit is contained in:
EnumDev committed 2026-05-04 21:33:35 +03:00
1 parent ef401b5aaa
commit e4462f9674
10 files changed
+245 -3

No files matched your search

+6
View File
@@ -134,6 +134,7 @@ func drawTopMenu(window *Window) {
func getBufferInfoMsg(window *Window) string {
pathToFile := "Not set"
filename := "Not set"
filetype := "Not set"
if window.CurrentBuffer.filename != "" {
pathToFile = window.CurrentBuffer.filename
}
@@ -141,6 +142,10 @@ func getBufferInfoMsg(window *Window) string {
filename = filepath.Base(window.CurrentBuffer.filename)
}
if window.CurrentBuffer.filetype != "" {
filetype = window.CurrentBuffer.filetype
}
contents := window.CurrentBuffer.GetContentsAsString()
chars := len(contents)
words := len(strings.Fields(string(contents)))
@@ -150,6 +155,7 @@ func getBufferInfoMsg(window *Window) string {
ret = strings.ReplaceAll(ret, "\n", " ")
ret = strings.ReplaceAll(ret, "%F", pathToFile)
ret = strings.ReplaceAll(ret, "%f", filename)
ret = strings.ReplaceAll(ret, "%t", filetype)
ret = strings.ReplaceAll(ret, "%x", strconv.Itoa(window.CurrentBuffer.CursorPos.X+1))
ret = strings.ReplaceAll(ret, "%y", strconv.Itoa(window.CurrentBuffer.CursorPos.Y+1))
ret = strings.ReplaceAll(ret, "%p", strconv.Itoa(window.CurrentBuffer.PositionToAbsolutePosition(window.CurrentBuffer.CursorPos)+1))