Skip to content

Textual 2.0.4 plus ghostty "fakes" escape press when mouse crosses window border #5559

Description

@davep

With this code:

from textual.app import App

class WeirdEscapeApp(App[None]):

    BINDINGS = [("escape", "escape")]

    def action_escape(self) -> None:
        self.notify("Escape was pressed!")

if __name__ == "__main__":
    WeirdEscapeApp().run()

I see this effect:

Screen.Recording.2025-02-19.at.10.56.58.mov

Testing with Textual 1.0.0 I don't see this. On the other hand I can't recreate it with iTerm and Textual 2.0.4 (haven't had the chance to test other terminals).

While I appreciate this might be specific to a particular pretty new terminal, I thought it worth a heads-up at least.

Textual Diagnostics

Versions

Name Value
Textual 2.0.4
Rich 13.9.4

Python

Name Value
Version 3.13.2
Implementation CPython
Compiler Clang 16.0.0 (clang-1600.0.26.6)
Executable /Users/davep/temp/x/.venv/bin/python

Operating System

Name Value
System Darwin
Release 24.3.0
Version Darwin Kernel Version 24.3.0: Thu Jan 2 20:23:36 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8112

Terminal

Name Value
Terminal Application ghostty (1.1.2)
TERM xterm-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=90, height=37
legacy_windows False
min_width 1
max_width 90
is_terminal False
encoding utf-8
max_height 37
justify None
overflow None
no_wrap False
highlight None
markup None
height None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions