summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-10-23 11:26:29 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-10-23 11:26:29 +0200
commitcc8aae7d300e7529fc8113b9d356702630f36df5 (patch)
tree77408852ad47009dcdb5006dcbdd3c343178d8ac /window.go
parentdoc: fix indentation and use _ instead of ` for keywords (diff)
Don't display buffer numbers on empty command
Diffstat (limited to 'window.go')
-rw-r--r--window.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/window.go b/window.go
index 7afa4e6..ce416ed 100644
--- a/window.go
+++ b/window.go
@@ -63,19 +63,19 @@ func (app *App) setStatus() {
func (app *App) setBufferNumbers() {
input := app.win.InputContent()
- if len(input) < 2 || input[0] != '/' {
+ if !isCommand(input) {
app.win.ShowBufferNumbers(false)
return
}
commandEnd := len(input)
- for i := 0; i < len(input); i++ {
+ for i := 1; i < len(input); i++ {
if input[i] == ' ' {
commandEnd = i
break
}
}
- command := string(input[:commandEnd])
- showBufferNumbers := strings.HasPrefix("/buffer", command)
+ command := string(input[1:commandEnd])
+ showBufferNumbers := len(command) != 0 && strings.HasPrefix("buffer", command)
app.win.ShowBufferNumbers(showBufferNumbers)
}