fix(stacked-panes): stop wrapping at stack boundaries
- commit
- 03190967ad8e533451285f170e34562362c4ecf3
- author
- bnema · · 2025-11-13 21:54 UTC
- committer
- bnema · · 2025-11-13 18:22 UTC
- parent
- 6bf432a
- signature
- unsigned
1 file · +6 -3
M internal/app/browser/stacked_panes.go +6 -3
| @@ -7,9 +7,10 @@ import ( | |||
| 7 | 7 | "sync/atomic" | |
| 8 | 8 | "time" | |
| 9 | 9 | ||
| 10 | - | "github.com/bnema/dumber/pkg/webkit" | |
| 11 | 10 | "github.com/diamondburned/gotk4/pkg/gdk/v4" | |
| 12 | 11 | "github.com/diamondburned/gotk4/pkg/gtk/v4" | |
| 12 | + | ||
| 13 | + | "github.com/bnema/dumber/pkg/webkit" | |
| 13 | 14 | ) | |
| 14 | 15 | ||
| 15 | 16 | const ( | |
| @@ -478,12 +479,14 @@ func (spm *StackedPaneManager) NavigateStack(direction string) bool { | |||
| 478 | 479 | case DirectionUp: | |
| 479 | 480 | newIndex = currentIndex - 1 | |
| 480 | 481 | if newIndex < 0 { | |
| 481 | - | newIndex = len(stackNode.stackedPanes) - 1 // Wrap to last | |
| 482 | + | // At the top of the stack - allow navigation outside | |
| 483 | + | return false | |
| 482 | 484 | } | |
| 483 | 485 | case DirectionDown: | |
| 484 | 486 | newIndex = currentIndex + 1 | |
| 485 | 487 | if newIndex >= len(stackNode.stackedPanes) { | |
| 486 | - | newIndex = 0 // Wrap to first | |
| 488 | + | // At the bottom of the stack - allow navigation outside | |
| 489 | + | return false | |
| 487 | 490 | } | |
| 488 | 491 | default: | |
| 489 | 492 | return false | |
| @@ -7,9 +7,10 @@ import ( | |||||
| 7 | "sync/atomic" | 7 | "sync/atomic" | ||
| 8 | "time" | 8 | "time" | ||
| 9 | 9 | ||||
| 10 | - | "github.com/bnema/dumber/pkg/webkit" | |||
| 11 | "github.com/diamondburned/gotk4/pkg/gdk/v4" | 10 | "github.com/diamondburned/gotk4/pkg/gdk/v4" | ||
| 12 | "github.com/diamondburned/gotk4/pkg/gtk/v4" | 11 | "github.com/diamondburned/gotk4/pkg/gtk/v4" | ||
| 12 | + | ||||
| 13 | + | "github.com/bnema/dumber/pkg/webkit" | |||
| 13 | ) | 14 | ) | ||
| 14 | 15 | ||||
| 15 | const ( | 16 | const ( | ||
| @@ -478,12 +479,14 @@ func (spm *StackedPaneManager) NavigateStack(direction string) bool { | |||||
| 478 | case DirectionUp: | 479 | case DirectionUp: | ||
| 479 | newIndex = currentIndex - 1 | 480 | newIndex = currentIndex - 1 | ||
| 480 | if newIndex < 0 { | 481 | if newIndex < 0 { | ||
| 481 | - | newIndex = len(stackNode.stackedPanes) - 1 // Wrap to last | 482 | + | // At the top of the stack - allow navigation outside |
| 483 | + | return false | |||
| 482 | } | 484 | } | ||
| 483 | case DirectionDown: | 485 | case DirectionDown: | ||
| 484 | newIndex = currentIndex + 1 | 486 | newIndex = currentIndex + 1 | ||
| 485 | if newIndex >= len(stackNode.stackedPanes) { | 487 | if newIndex >= len(stackNode.stackedPanes) { | ||
| 486 | - | newIndex = 0 // Wrap to first | 488 | + | // At the bottom of the stack - allow navigation outside |
| 489 | + | return false | |||
| 487 | } | 490 | } | ||
| 488 | default: | 491 | default: | ||
| 489 | return false | 492 | return false | ||