Textualize/textual

Escape sequences after exiting app with `run(mouse=False)`

TomJGooding opened this issue · 4 comments

I found this while experimenting with the new mouse parameter added to App.run in Textual v0.55.0.

Try exiting the app below and then moving the mouse in your terminal:

from textual.app import App


class ExampleApp(App):
    pass


if __name__ == "__main__":
    app = ExampleApp()
    app.run(mouse=False)

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

Actually if you try moving your mouse around for a few seconds while the app is running, it will crash with:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 4: invalid start byte

Maybe worth knowing:
I also noticed the run_async default behavior has changed. By default it now has mouse=False, so launching as a regular TUI app result in the same error as @TomJGooding mentioned.

Of course, it's easily fixable but brought me some questions as I haven't noticed anything related in the latest release note. And noticed that, because we use it like asyncio.run(app.run_async()) instead of app.run() because of the need for our own event loop (apart from that, I don't see anything wrong with it since it's a public interface)

Don't forget to star the repository!

Follow @textualizeio for Textual updates.