commit decbe3d

delthas  ·  2023-11-17 00:17:35 +0000 UTC
parent 94a8582
Make buffer indexes for /buffer start at 1

This is more intuitive for users. (A file starts at line 1, a list
of buffer starts at buffer 1).

It also aligns the number with the shortcut for Alt+$number.

Thanks to Eric Bower <me@erock.io> for finding the initial bug.

See: https://lists.sr.ht/~delthas/senpai-dev/patches/33541
2 files changed,  +2, -2
+1, -1
1@@ -341,7 +341,7 @@ func commandDoBuffer(app *App, args []string) error {
2 	name := args[0]
3 	i, err := strconv.Atoi(name)
4 	if err == nil {
5-		if app.win.JumpBufferIndex(i) {
6+		if app.win.JumpBufferIndex(i - 1) {
7 			return nil
8 		}
9 	}
+1, -1
1@@ -684,7 +684,7 @@ func (bs *BufferList) DrawVerticalBufferList(screen tcell.Screen, x0, y0, width,
2 		}
3 		if bs.showBufferNumbers {
4 			indexSt := st.Foreground(tcell.ColorGray)
5-			indexText := fmt.Sprintf("%d:", bi)
6+			indexText := fmt.Sprintf("%d:", bi+1)
7 			printString(screen, &x, y, Styled(indexText, indexSt))
8 			x = x0 + indexPadding
9 		}