mirror of
https://github.com/EnumeratedDev/typer.git
synced 2026-10-31 11:31:48 +00:00
Add simple syntax highlighting
This commit is contained in:
10 files changed
+245
-3
No files matched your search
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user