Skip to content

F3 Key triggers CursorPosition event, ignores Bindings in some terminals #6242

@Epse

Description

@Epse

Have you checked closed issues? (https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed)
Yes

Have you checked against the most recent version of Textual? (https://pypi.org/search/?q=textual)
Yes

The bug

A plain App instance with a binding for the f3 key does not trigger the action bound. The console does not show any Key events, only a CursorPosition event gets logged, contrary to most other keys.

An example app that triggers this below, note that I added two bindings to the test action, to demonstrate the difference. You can remove the f2 binding and the issue will still happen, this just allows easier validation that the action is not malformatted.

from textual.app import App, ComposeResult, SystemCommand

class MyApp(App):
    BINDINGS = [("f3,f2", "test", "Test")] 
    
    def action_test(self):
        self.notify("Test succeeded")


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

An example of the logged CursorPosition:

[10:55:46] EVENT                                                                       message_pump.py:822
CursorPosition(x=128, y=0) >>> CawApp(title='CAW Client', classes={'-dark-mode'}, pseudo_classes={'focus',
'dark'}) method=None

this log entry has a horizontal entry above and below in the console.

In textual-keys the f3 key shows up normally. This issue has been triggered on the terminals kitty and foot. It works correctly in XTerm, UXterm, GNOME terminal and cool-retro-term.

I found this vim mailing list entry which gives some pointers.

Diagnosis output:

Kitty diagnosis

Textual Diagnostics

Versions

Name Value
Textual 6.5.0
Rich 14.2.0

Python

Name Value
Version 3.12.5
Implementation CPython
Compiler Clang 18.1.8
Executable /home/idlab261/projects/cawclient/.venv/bin/python3

Operating System

Name Value
System Linux
Release 6.8.0-87-generic
Version #88~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Oct 14 14:03:14 UTC 2

Terminal

Name Value
Terminal Application Unknown
TERM xterm-kitty
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

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