commit ae42619

delthas  ·  2023-11-09 10:23:46 +0000 UTC
parent 21fcd22
Keep current buffer when deleting a buffer higher in the list
1 files changed,  +2, -2
+2, -2
 1@@ -384,7 +384,7 @@ func (bs *BufferList) Remove(netID, title string) bool {
 2 	updated := bs.current == idx
 3 
 4 	bs.list = append(bs.list[:idx], bs.list[idx+1:]...)
 5-	if len(bs.list) <= bs.current {
 6+	if bs.current >= idx {
 7 		bs.current--
 8 	}
 9 	if updated {
10@@ -407,7 +407,7 @@ func (bs *BufferList) RemoveNetwork(netID string) {
11 			updated = true
12 		}
13 		bs.list = append(bs.list[:idx], bs.list[idx+1:]...)
14-		if len(bs.list) <= bs.current {
15+		if bs.current >= idx {
16 			bs.current--
17 		}
18 		idx--