Fix: Change copy filepath shortcut from CTRL+Q to CTRL+Y for macOS compatibility (Fixes #617)#692
Conversation
for more information, see https://pre-commit.ci
|
Hey @JoeZiminski, just to give some context the previous PR #681 was accidentally closed when I force-pushed main while syncing my fork with upstream, sorry about that. In this PR I also reconsidered the shortcut key CTRL+W deletes a word and CTRL+K deletes to end of line on macOS, so both had the same problem as CTRL+Q. Went with CTRL+Y instead which has no conflicts on macOS. Since textual captures keystrokes internally, OS-level shortcuts like redo on Windows shouldn't interfere either. Tested locally on macOS and it works perfectly. |
|
Hi @AdityaGupta716 thanks for this! Really appreciate the testing, I will look into this in the next couple of days and merge as a priority, I think it would be good to include this in the upcoming release. [EDIT: no worries at all about the PR closing / force push! These issues are very common] |
|
Hi @AdityaGupta716 thanks again for this, could you confirm that it is indeed CTRL+Q that quits the application, rather than command (CMD) key, i.e. CMD+Q? (the issue was recently updated). I could not replicate CTRL+Q closing the application on macOS. Unfortunately, the CMD key in macOS cannot be read by the terminal, or at least is not by default, meaning we cannot use CMD as a shortcut. The CMD key does a lot of default macOS behaviour which is very confusing. At the moment I think there is simply no workaround, which is frustrating. It might still be worth changing the CTRL+Q to CTRL+Y because even if CTRL+Q does not close the application, people are likely to confuse it with CMD+Q then close the application, which is confusing. In your hands, does it immediately close the application, or do you get a pop-up? I would immediately change it to CTRL+Y, but for backwards compatibility reasons it would be nice to keep with CTRL+Q unless it is prohibitively annoying. I think at least, we can add a warning to the documentation (maybe the install page, and choosing a terminal page). |
|
Hi @JoeZiminski, CTRL+Q is clean and even if we press CMD+Q by mistake on Mac a popup comes up that tells us "do you want to terminate the terminal" so the user at least knows what happened. CTRL+Y also has no conflicts on macOS or Windows, and since CMD+Q gives a popup the user will know they haven't copied, but CMD+Y won't give anything so the user may get stuck for a few seconds thinking what did they do wrong. Either way Mac people won't get the command key so it's fine to pick anything. |
|
Hi @AdityaGupta716 thanks for your thoughts on this and looking into it further with CTRL+C. I'm glad you mentioned about the pop-up reminding users they may have pressed the wrong button, that was my thinking too. In this case, it's good to know CTRL+Q is workable. Thanks also for investigating CTRL+C. funnily enough we did used to have CTRL+C for the copy behavior, but it lead to some problems. In theory textual should take the CTRL+C event and not let it close the terminal (which can happen on Windows). However in practice this behavior was not consistent, and sometimes on Windows CTRL+C would close the terminal (see #573). This is quite unfortunate, as it would otherwise be a nice solution! Unfortunately handling these shortcuts cross-platform through the terminal is very tricky :( |
|
@JoeZiminski, seems like ctrl+q is actually the best cross-platform choice — works fine on macOS, no issues on Windows either. Unless there's something else you'd like me to look into, I think this PR and issue can be closed! |
|
Thanks @AdityaGupta716 I agree we can close this, thanks a lot for looking into this, the research and discussing through ideas has been very useful! Cheers |
closes #617
What is this PR
Bug fix
Why is this PR needed?
Issue #617 reported that
CTRL+Qquits the application on macOS, making it impossible to use the copy filepath shortcut on that platform.CTRL+WandCTRL+Kwere also considered but both have conflicts on macOS (CTRL+Wdeletes a word,CTRL+Kdeletes to end of line).CTRL+Yhas no conflicts on any platform.What does this PR do?
ctrl+qtoctrl+yincustom_widgets.pytooltips.pyandapp.pycreate-folders.mdandgetting-started.mdtest_tui_directorytree.pyTested locally on macOS —
CTRL+Ycopies filepath correctly without any conflicts.