textual icon indicating copy to clipboard operation
textual copied to clipboard

`TextArea` with indent tab behaviour won't minimize on `esc` key

Open TomJGooding opened this issue 1 year ago • 2 comments

I'm not sure what default behaviour is expected in this scenario, but consider this simple example containing a TextArea.code_editor. After maximizing this widget, pressing the esc key won't minimize it again because it is expected this will instead move focus.

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

TEXT = """\
def hello(name):
    print("hello" + name)

def goodbye(name):
    print("goodbye" + name)
"""


class TextAreaExample(App):
    CSS = """
    Screen {
        align: center middle;
    }

    #code-container {
        width: 20%;
        height: 20%;
    }
    """

    def compose(self) -> ComposeResult:
        with Vertical(id="code-container"):
            yield TextArea.code_editor(TEXT, language="python")


app = TextAreaExample()
if __name__ == "__main__":
    app.run()

TomJGooding avatar Aug 27 '24 13:08 TomJGooding

It's intended to minimize: https://github.com/Textualize/textual/pull/4931#discussion_r1731011637

darrenburns avatar Aug 27 '24 13:08 darrenburns

Good catch, the minimize should be done earlier.

willmcgugan avatar Aug 27 '24 20:08 willmcgugan

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

github-actions[bot] avatar Aug 28 '24 09:08 github-actions[bot]