-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
It seems that calling pop (or remove_items, though that's not what I'm using for my use case) does not correctly update highlighting (presumably because calling pop does not update the index).
A small reproduction is as follows:
from textual.app import App, ComposeResult
from textual.widgets import ListItem, ListView, Footer
class TestApp(App):
BINDINGS = [
('a', 'add', 'Adds a blank item'),
('d', 'delete_highlighted', 'Deletes the highlighted cell'),
]
_listview: ListView
def compose(self) -> ComposeResult:
self._listview = ListView(ListItem())
yield Footer()
yield self._listview
def action_add(self):
self._listview.append(ListItem())
def action_delete_highlighted(self):
index = self._listview.index
self._listview.pop(index)
if __name__ == '__main__':
TestApp().run()Spawning a few items and trying to delete them does not set any highlighting, only manually updating the index will do that.
Textual Diagnostics
Versions
| Name | Value |
|---|---|
| Textual | 0.83.0 |
| Rich | 13.9.2 |
Python
| Name | Value |
|---|---|
| Version | 3.12.1 |
| Implementation | CPython |
| Compiler | Clang 17.0.6 |
| Executable | /home/king/Projects/private/.venv/bin/python |
Operating System
| Name | Value |
|---|---|
| System | Linux |
| Release | 6.10.11-amd64 |
| Version | #1 SMP PREEMPT_DYNAMIC Debian 6.10.11-1 (2024-09-22) |
Terminal
| Name | Value |
|---|---|
| Terminal Application | Unknown |
| TERM | xterm-256color |
| COLORTERM | truecolor |
| FORCE_COLOR | Not set |
| NO_COLOR | Not set |
Rich Console options
| Name | Value |
|---|---|
| size | width=223, height=76 |
| legacy_windows | False |
| min_width | 1 |
| max_width | 223 |
| is_terminal | True |
| encoding | utf-8 |
| max_height | 76 |
| justify | None |
| overflow | None |
| no_wrap | False |
| highlight | None |
| markup | None |
| height | None |
TomJGooding
Metadata
Metadata
Assignees
Labels
No labels