-
Notifications
You must be signed in to change notification settings - Fork 814
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
TextArea code editor freezes the app #5151
Comments
Hi, thanks for the report. I can't reproduce this. Could you please share the full error output? |
@darrenburns This freeze only seems to happen with the latest rich version 13.9.2. I suspect related to Textualize/rich#3532? |
Yeah, I tried with Rich 13.9.2 and Textual v0.83.0 (and Edit: tried with various sizes and can't reproduce 🤔 |
I'll look in to this today. |
Ok apparently this bug only happens if the first character in the text area is e.g.
It seems to be when Will has a PR which fixes it but we don't know why 😂 |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Bizarre! After testing working through the alphabet, "o" doesn't seem to crash but "p" does... |
After being nerd sniped by this, I couldn't help trying to dig a bit deeper. I found this line in rich/rich/cells.py: _is_single_cell_widths = re.compile("^[\u0020-\u006f\u00a0\u02ff\u0370-\u0482]*$").match This might explain why this only seems to occur with certain characters, since this doesn't seem to include lowercase p-z? |
Bravo, Tom! |
Thank you Tom, I will sleep tonight!! |
How did you get there so fast @TomJGooding ? We were bamboozled by this. |
Haha, definitely a team effort! |
Hey again. :)
Mounting the TextArea code editor with any code other than the comment freezes my terminal. I tried several versions of Textual, I tried running it both on Mac and Linux and using Python 3.10 and 3.12. It freezes every time. I then tried an example from the docs and it freezes too.
An MRE:
If you replace usage of
FAIL_TEXT
withOK_TEXT
, it doesn't freeze. Somehow it doesn't freeze withFAIL_TEXT
too if you setshow_line_numbers=False
.I tried investigating it a bit myself and I found out that the freeze happens because of the
while True
loop inrich.segment.Segment._split_cells
: it keeps countingpos
down and never stops. I'm not sure why, though. And I still don't know why the comment works alright even with the line numbers.Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: