-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
The bug
I have a ListView that shows items based on a reactive field. It does update its items correctly. However, after changing its items (with clear() and extend()) and setting an index, there is no highlight. The selection seems to be correct, but I can only see it after interacting with the list.
Code example:
def watch_items(self, things) -> None:
list = self.query_one("#listview", ListView)
index = list.index or 0
with self.app.batch_update():
list.clear()
list.extend([ListItem(Label(it.name)) for it in things])
It will be helpful if you run the following command and paste the results:
# Textual Diagnostics
## Versions
| Name | Value |
|---------|--------|
| Textual | 6.11.0 |
| Rich | 14.2.0 |
## Python
| Name | Value |
|----------------|----------------------------------------------------|
| Version | 3.13.5 |
| Implementation | CPython |
| Compiler | Clang 20.1.4 |
| Executable | /home/fdw/Code/podcast_migration/.venv/bin/python3 |
## Operating System
| Name | Value |
|---------|--------------------------------------------------------|
| System | Linux |
| Release | 6.18.2-1-MANJARO |
| Version | #1 SMP PREEMPT_DYNAMIC Thu, 18 Dec 2025 13:50:16 +0000 |
## Terminal
| Name | Value |
|----------------------|-------------|
| Terminal Application | Kitty |
| TERM | xterm-kitty |
| COLORTERM | truecolor |
| FORCE_COLOR | *Not set* |
| NO_COLOR | *Not set* |
## Rich Console options
| Name | Value |
|----------------|----------------------|
| size | width=320, height=79 |
| legacy_windows | False |
| min_width | 1 |
| max_width | 320 |
| is_terminal | True |
| encoding | utf-8 |
| max_height | 79 |
| justify | None |
| overflow | None |
| no_wrap | False |
| highlight | None |
| markup | None |
| height | None |
Metadata
Metadata
Assignees
Labels
No labels