Skip to content

Conversation

@SayMyN0me
Copy link

Background

On a fresh setup, zulip-terminal may crash at startup with an "index out of range" error when setting the initial focus.

Root Cause

During early UI initialization the focus index can be computed before the message list is populated, or exceed bounds.

Fix

  • Guard focus assignment when the list is empty (no crash).
  • Clamp focus into [0, len-1] when index is out of range.
  • Preserve existing semantics by calling _focus_changed/_action/_modified as needed.

Tests

  • Added focused regression tests in tests/local/test_modlistwalker_focus_guard.py (empty/negative/oob focus).
  • Local result: 3 passed (see artifacts).

@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L [Automatic label added by zulipbot]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants