Skip to content

Cursor key detected as Escape on iTerm2 #5251

@max-arnold

Description

@max-arnold

The issue happens on iTerm2 under macOS, and doesn't happen in the stock Terminal app. When I press and hold the down arrow key, the minimal Textual application (see below) exits and prints ^[[B in the terminal. Looks similar to #4816.

2024-11-18 11 12 17

from textual.app import App

class MyApp(App):
    BINDINGS = [
        ("escape", "quit()", "Quit"),
    ]

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

Tried resetting iTerm2 settings to default values by deleting the ~/Library/Preferences/com.googlecode.iterm2.plist, but the issue still persists.

# Textual Diagnostics

## Versions

| Name    | Value  |
|---------|--------|
| Textual | 0.86.1 |
| Rich    | 13.9.4 |

## Python

| Name           | Value                               |
|----------------|-------------------------------------|
| Version        | 3.12.6                              |
| Implementation | CPython                             |
| Compiler       | Clang 14.0.3 (clang-1403.0.22.14.1) |
| Executable     | /private/tmp/test/.venv/bin/python3 |

## Operating System

| Name    | Value                                                                                                  |
|---------|--------------------------------------------------------------------------------------------------------|
| System  | Darwin                                                                                                 |
| Release | 22.6.0                                                                                                 |
| Version | Darwin Kernel Version 22.6.0: Thu Sep  5 20:48:48 PDT 2024; root:xnu-8796.141.3.708.1~1/RELEASE_X86_64 |

## Terminal

| Name                 | Value             |
|----------------------|-------------------|
| Terminal Application | iTerm.app (3.5.9) |
| TERM                 | xterm-256color    |
| COLORTERM            | truecolor         |
| FORCE_COLOR          | *Not set*         |
| NO_COLOR             | *Not set*         |

## Rich Console options

| Name           | Value               |
|----------------|---------------------|
| size           | width=80, height=25 |
| legacy_windows | False               |
| min_width      | 1                   |
| max_width      | 80                  |
| is_terminal    | True                |
| encoding       | utf-8               |
| max_height     | 25                  |
| 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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions