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

Mouse selection bug with Tab characters in TextArea with soft_wrap disabled #5212

Closed
TheNaterz opened this issue Nov 5, 2024 · 2 comments · Fixed by #5237
Closed

Mouse selection bug with Tab characters in TextArea with soft_wrap disabled #5212

TheNaterz opened this issue Nov 5, 2024 · 2 comments · Fixed by #5237

Comments

@TheNaterz
Copy link

The following code creates 2 TextAreas pre-populated with 20 Tab characters.

from textual.app import App, ComposeResult
from textual.widgets import TextArea

class MyApp(App):

    def compose(self) -> ComposeResult:
        yield TextArea(
            id='textarea1',
            soft_wrap=False,
            text="\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
        )
        yield TextArea(
            id='textarea2',
            soft_wrap=True,
            text="\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
        )

if __name__ == "__main__":
    MyApp().run()

The first TextArea has soft_wrap disabled, while the second one does not.

By using a mouse to select the Tab characters, the selection in the first TextArea incorrectly jumps forward 1 tab character per space. The selection in the second TextArea follows the expected behavior.

Textual Diagnostics

Versions

Name Value
Textual 0.85.2
Rich 13.9.4

Python

Name Value
Version 3.12.0
Implementation CPython
Compiler MSC v.1935 64 bit (AMD64)
Executable C:\Program Files\Python312\python3.exe

Operating System

Name Value
System Windows
Release 10
Version 10.0.19045

Terminal

Name Value
Terminal Application Windows Terminal
TERM Not set
COLORTERM Not set
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=188, height=52
legacy_windows False
min_width 1
max_width 188
is_terminal True
encoding utf-8
max_height 52
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

github-actions bot commented Nov 5, 2024

We found the following entries 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

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