summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-10-19 21:13:25 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-10-19 21:13:25 +0200
commitce78dab820c632550c7e767e4601d0d4d2e34de2 (patch)
treec14d06b0f2d44a6052e0c9d4daa294f7d61a641e /window.go
parentDon'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.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/window.go b/window.go
index 4e89ee8..7afa4e6 100644
--- a/window.go
+++ b/window.go
@@ -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))