Preserve preview and advance selection on thread deletion and triage #86

Merged
clanker merged 2 commits from pr/sse-reactive-selection-advance into main 2026-09-12 02:13:49 +00:00
Member

Summary

  • Advance Selection on Single-Thread Actions: Implemented SearchPanel._advance_selection to immediately advance cursor selection to the adjacent thread (next row or previous if on the last row). If the preview pane is open, it immediately opens the newly selected thread.
  • Selection Anchor by Thread ID: In SearchPanel.update_thread, restored selection explicitly by thread_id when rows are removed or modified, preventing Qt index reuse stalls where currentChanged would not fire.
  • Prevent Preview Pane Collapse on EmptyThreadError: In ThreadPanel.refresh and ThreadPanel.update_thread, if a thread is emptied or trashed, check if the current active list still has remaining threads and transition to the current thread instead of tearing down the preview pane container.
  • Unit Tests: Added test coverage in tests/test_actions.py for forward cursor advancement, end-of-list reversal, and preview preservation.

Test Plan

  • Run full pytest test suite: ~/.local/share/pipx/venvs/lazarus-mail/bin/pytest (all 522 tests pass).
  • Open Lazarus, select a thread with preview open, press d / a. Verify the preview advances smoothly to the adjacent thread without collapsing the preview container.
### Summary - **Advance Selection on Single-Thread Actions**: Implemented `SearchPanel._advance_selection` to immediately advance cursor selection to the adjacent thread (next row or previous if on the last row). If the preview pane is open, it immediately opens the newly selected thread. - **Selection Anchor by Thread ID**: In `SearchPanel.update_thread`, restored selection explicitly by `thread_id` when rows are removed or modified, preventing Qt index reuse stalls where `currentChanged` would not fire. - **Prevent Preview Pane Collapse on EmptyThreadError**: In `ThreadPanel.refresh` and `ThreadPanel.update_thread`, if a thread is emptied or trashed, check if the current active list still has remaining threads and transition to the current thread instead of tearing down the preview pane container. - **Unit Tests**: Added test coverage in `tests/test_actions.py` for forward cursor advancement, end-of-list reversal, and preview preservation. ### Test Plan - Run full pytest test suite: `~/.local/share/pipx/venvs/lazarus-mail/bin/pytest` (all 522 tests pass). - Open Lazarus, select a thread with preview open, press `d` / `a`. Verify the preview advances smoothly to the adjacent thread without collapsing the preview container.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Home/lazarus!86
No description provided.