Skip to content

fix(tui): correct cursor tracking for group reorder K/J#399

Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
essentialols:feature/group-reorder-tui
Mar 26, 2026
Merged

fix(tui): correct cursor tracking for group reorder K/J#399
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
essentialols:feature/group-reorder-tui

Conversation

@essentialols
Copy link
Copy Markdown
Contributor

Summary

  • Fixes cursor tracking when reordering groups with K/J (Shift+Up/Down) in the TUI
  • Previously the cursor moved by a fixed +/-1 offset after group reorder, which was incorrect when the adjacent group had expanded sessions (the group header jumps over multiple flat items when groups swap)
  • Now searches for the moved group's actual position in the rebuilt flat list, keeping the cursor on the correct group
  • Switches group reorder persistence to saveGroupState() (lightweight, no Touch trigger) instead of saveInstances(), since only group Order values change

Test plan

  • go build ./... compiles cleanly
  • go test ./internal/session/ -run MoveGroup -v passes
  • Manual: create 2+ groups with sessions, use K/J to reorder groups, verify cursor follows the group header correctly
  • Manual: restart TUI after reordering groups, verify order is persisted

Fixes #398

When reordering groups with K/J, the cursor now tracks to the group's
actual position after rebuilding the flat item list. Previously the
cursor moved by a fixed offset of 1, which was incorrect when the
adjacent group had expanded sessions (the group header would jump over
multiple flat items).

Also switches group reorder persistence from saveInstances() to the
lighter-weight saveGroupState(), since only group Order values change.

Fixes asheshgoplani#398
@asheshgoplani asheshgoplani merged commit 5c50dfd into asheshgoplani:main Mar 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support reordering groups (K/J or similar)

2 participants