-
Notifications
You must be signed in to change notification settings - Fork 826
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 with long lines throws an exception when the window is too small #2900
Comments
Good catch; some work should either be done to truncate options longer than the width, or |
I have worked around it by simply having shorter labels - for now :) If you have any pointers on how this could be solved, and where to solve it, I might be able to put in the grunt work. But as everybody else I'm short for time, so it's a big maybe :) |
It's all down to how I sense it's a quick design chat we'll need internally first before fixing this. |
I have also tried to size my content upon resize event, but it doesn't solve the issue. In this case, it will even crash on increasing the terminal size. I assume that the function that sets the content length might be called before the the code that crashes. Code to reproduce the crash upon increasing: import textual.widgets
import textual.app
import textual.events
import textual
class App(textual.app.App):
@textual.on(textual.events.Resize)
def resize_handler(self):
width = self.size.width
text = 'a' * (width - 4)
widget = self.query_one(textual.widgets.SelectionList)
widget.clear_options()
widget.add_option((text, 0, None))
def compose(self):
yield textual.widgets.SelectionList (('random_text', 0), id='widget_id')
if __name__ == '__main__':
App().run() |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
Bug report
Running the following in a smallish window, or resizing below the length of the selection length:
results in the following exception:
The text was updated successfully, but these errors were encountered: