-
Notifications
You must be signed in to change notification settings - Fork 852
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
SelectionList
-> OptionList.render_line
Unhandled IndexError
#5568
Comments
Funnily enough I just hit a similar In my case, the exception occurred after trying to resize my terminal to full screen. I can't reproduce it every time but fairly reliably after resizing the terminal for a while. |
I was trying to the reproduce it the way you described, but it doesn't want to error. I am curious what terminal emulator are you using? |
I don't think this is related to specific emulators. Try messing around with your terminal size with this app: from textual.app import App, ComposeResult
from textual.widgets import OptionList
class ExampleApp(App):
def compose(self) -> ComposeResult:
yield OptionList(
*[
f"This is option {i} which is long and may wrap when resized"
for i in range(100)
]
)
if __name__ == "__main__":
app = ExampleApp()
app.run() |
Yeah, I managed to reproduce the same error with a lot resizing with the example you gave. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
The Bug
When using a
SelectionList
therender_line
method of the new option list is throwing anIndexError
exception when the strips are empty.Traceback
MRE
I found this error extremely flakey at times, as sometimes it would only pop up in test runs, so let me know if there is additional info I can provide.
Looking through the previous
OptionList
, I found that it had anIndexError
exception handler at this point, so maybe that should be reverted?textual/src/textual/widgets/_option_list.py
Lines 884 to 887 in 1c23d6c
Sidenote is that the strips are being first nulled at the
RichVisual.render_strips
method here:textual/src/textual/visual.py
Lines 305 to 314 in 699cc86
Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: