commit cc8aae7

Hubert Hirtz  ·  2021-10-23 09:26:29 +0000 UTC
parent 411d806
Don't display buffer numbers on empty command
1 files changed,  +4, -4
+4, -4
 1@@ -63,19 +63,19 @@ func (app *App) setStatus() {
 2 
 3 func (app *App) setBufferNumbers() {
 4 	input := app.win.InputContent()
 5-	if len(input) < 2 || input[0] != '/' {
 6+	if !isCommand(input) {
 7 		app.win.ShowBufferNumbers(false)
 8 		return
 9 	}
10 	commandEnd := len(input)
11-	for i := 0; i < len(input); i++ {
12+	for i := 1; i < len(input); i++ {
13 		if input[i] == ' ' {
14 			commandEnd = i
15 			break
16 		}
17 	}
18-	command := string(input[:commandEnd])
19-	showBufferNumbers := strings.HasPrefix("/buffer", command)
20+	command := string(input[1:commandEnd])
21+	showBufferNumbers := len(command) != 0 && strings.HasPrefix("buffer", command)
22 	app.win.ShowBufferNumbers(showBufferNumbers)
23 }
24