Problem
When switching between the Notebooks and Recents tabs with Tab, the cursor always resets to position 0. If you're on the 5th notebook and press Tab to check recents, then Tab back, you're back at the top instead of where you left off.
Context
The tab handler in internal/browser/browser.go line 362 unconditionally sets m.cursor = 0:
case "tab":
if m.level == 0 {
m.recentsView = !m.recentsView
m.cursor = 0 // <-- always resets
The model already has savedCursor for L0→L1 transitions but nothing for tab switching.
Fix
Add a savedRecentsCursor int field to the Model. When switching tabs, save the current cursor and restore the saved one for the target tab.
case "tab":
if m.level == 0 {
if m.recentsView {
m.savedRecentsCursor = m.cursor
m.cursor = m.savedCursor // reuse existing field for notebooks cursor
} else {
m.savedCursor = m.cursor
m.cursor = m.savedRecentsCursor
}
m.recentsView = !m.recentsView
Clamp restored cursor to list bounds after loading in case items were removed.
File: internal/browser/browser.go
Tasks
Test plan
Scope
Type: bug
Size: small
Problem
When switching between the Notebooks and Recents tabs with Tab, the cursor always resets to position 0. If you're on the 5th notebook and press Tab to check recents, then Tab back, you're back at the top instead of where you left off.
Context
The tab handler in
internal/browser/browser.goline 362 unconditionally setsm.cursor = 0:The model already has
savedCursorfor L0→L1 transitions but nothing for tab switching.Fix
Add a
savedRecentsCursor intfield to the Model. When switching tabs, save the current cursor and restore the saved one for the target tab.Clamp restored cursor to list bounds after loading in case items were removed.
File:
internal/browser/browser.goTasks
savedRecentsCursor intto Model structTest plan
Scope
Type: bug
Size: small