Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection List Wrapped Text Indexing #5326

Closed
ddkasa opened this issue Dec 2, 2024 · 2 comments · Fixed by #5331
Closed

Selection List Wrapped Text Indexing #5326

ddkasa opened this issue Dec 2, 2024 · 2 comments · Fixed by #5331

Comments

@ddkasa
Copy link
Contributor

ddkasa commented Dec 2, 2024

Description

When a SelectionList item is too long and starts wrapping text to new lines the indexing breaks, as the logic considers new lines as new items.

Video

selection_bug.webm

MRE

from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widgets import SelectionList


class BugReportApp(App):
    CSS = """
    #main {
        padding: 5;
    }
    """

    def compose(self) -> ComposeResult:
        with Container(id="main"):
            yield SelectionList(
                (
                    "adawdawawfawffffffffffffffffffffffffffffffffffffffffffffffffffffffawdwadddddddddddddddddddddddddddddddddddddddddddddddddddddd",
                    0,
                ),
            )


if __name__ == "__main__":
    app = BugReportApp()
    app.run()

Textual Diagnostics

Versions

Name Value
Textual 0.88.1
Rich 13.9.4

Python

Name Value
Version 3.12.3
Implementation CPython
Compiler GCC 13.2.1 20240316 (Red Hat 13.2.1-7)
Executable /home/dk/dev/tmp/textual-selection-list/.venv/bin/python

Operating System

Name Value
System Linux
Release 6.11.8-200.fc40.x86_64
Version #1 SMP PREEMPT_DYNAMIC Thu Nov 14 20:38:18 UTC 2024

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=137, height=54
legacy_windows False
min_width 1
max_width 137
is_terminal True
encoding utf-8
max_height 54
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

github-actions bot commented Dec 2, 2024

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

Copy link

github-actions bot commented Dec 3, 2024

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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 a pull request may close this issue.

1 participant