Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "esc" as a key alias of "escape" #5593

Closed
thejcannon opened this issue Feb 27, 2025 · 9 comments
Closed

Add "esc" as a key alias of "escape" #5593

thejcannon opened this issue Feb 27, 2025 · 9 comments

Comments

@thejcannon
Copy link

I spent an embarassing amount of time trying to understand why my "esc" binding (or key_esc) wasn't working.

It took poking at keys.py to notice my unfortunate mistake...

Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

There may be multiple ways of abbreviating key names, which is why I don't like to abbreviate at all. Run textual keys if you aren't sure.

@TomJGooding
Copy link
Contributor

It's a shame you wasted any time on this, as running textual keys would quickly find the key names.

I know this is mentioned in the FAQ, but perhaps this could be advertised more widely in the docs?

@thejcannon
Copy link
Author

thejcannon commented Feb 27, 2025

I actually tried running textual keys many times, but I was only met (in hindsight) with my own stupidity.

All incarnations of trying to run it ended up with me unknowingly using our work pypi which still has 1.X and so I was getting the old textual demo OR when I tried things like uvx I got "textual has no console scripts" (again with perfect hindsight realizing now I should've used textual-dev (i think this is uvx --with textual-dev textual keys).


Perhaps a separate request could be ensuring textual-dev has a textual-dev console script, and unilaterally suggesting people run textual-dev keys (and similar for the other subcommands).

That means I would've run uvx textual-dev keys and it should've "just worked"

@thejcannon
Copy link
Author

There may be multiple ways of abbreviating key names, which is why I don't like to abbreviate at all. Run textual keys if you aren't sure.

That's understandable. Hopefully my mistake is also understandable (given how my keyboard says "esc" and "ctrl").

Out of raw curiosity, what's the downside to this alias (or any alias)?

@thejcannon
Copy link
Author

Also FWIW happy to make PR for anything I suggest 🤩

@willmcgugan
Copy link
Collaborator

Perhaps a separate request could be ensuring textual-dev has a textual-dev console script, and unilaterally suggesting people run textual-dev keys (and similar for the other subcommands).

I wouldn't want the commands to run in their own environment. They could be out of sync with the project.

Out of raw curiosity, what's the downside to this alias (or any alias)?

I don't see much point in maintaining aliases (there could be many, not just escape), when the "no abbreviation" rule of thumb generally makes it clear. It would also lead to code that has keys using different spellings, and confuse beginners.

I didn't mean to imply any criticism for getting it wrong. Easy done, but now that you know, you know.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@thejcannon
Copy link
Author

Perhaps a separate request could be ensuring textual-dev has a textual-dev console script, and unilaterally suggesting people run textual-dev keys (and similar for the other subcommands).

I wouldn't want the commands to run in their own environment. They could be out of sync with the project.

Out of raw curiosity, what's the downside to this alias (or any alias)?

I don't see much point in maintaining aliases (there could be many, not just escape), when the "no abbreviation" rule of thumb generally makes it clear. It would also lead to code that has keys using different spellings, and confuse beginners.

I didn't mean to imply any criticism for getting it wrong. Easy done, but now that you know, you know.

In this case suggesting running textual-dev would've been a clue (and wouldn't possibly out of sync). That's also true if someone runs uv run ... since that uses the same python env by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants