diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2021-10-19 21:13:25 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-10-19 21:13:25 +0200 |
commit | ce78dab820c632550c7e767e4601d0d4d2e34de2 (patch) | |
tree | c14d06b0f2d44a6052e0c9d4daa294f7d61a641e /window.go | |
parent | Don't forget to close outgoing chan on debug (diff) |
Only show buffer numbers when necessary
Saves space
also removed non-edition related method IsCommand out of editor.go
Diffstat (limited to 'window.go')
-rw-r--r-- | window.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -61,6 +61,24 @@ func (app *App) setStatus() { app.win.SetStatus(status) } +func (app *App) setBufferNumbers() { + input := app.win.InputContent() + if len(input) < 2 || input[0] != '/' { + app.win.ShowBufferNumbers(false) + return + } + commandEnd := len(input) + for i := 0; i < len(input); i++ { + if input[i] == ' ' { + commandEnd = i + break + } + } + command := string(input[:commandEnd]) + showBufferNumbers := strings.HasPrefix("/buffer", command) + app.win.ShowBufferNumbers(showBufferNumbers) +} + func identColor(ident string) tcell.Color { h := fnv.New32() _, _ = h.Write([]byte(ident)) |