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

Support key repetition in terminal #4740

Open
1 task done
failable opened this issue May 17, 2023 · 14 comments
Open
1 task done

Support key repetition in terminal #4740

failable opened this issue May 17, 2023 · 14 comments
Labels
enhancement [core label] terminal Feedback for terminal integration, shell commands, etc

Comments

@failable
Copy link

Check for existing issues

  • Completed

Describe the feature

Keyboard repetition does not work for some keys like a-z in terminal while it works in Alacritty.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@failable failable added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels May 17, 2023
@JosephTLyons JosephTLyons added terminal Feedback for terminal integration, shell commands, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels May 19, 2023
@bswinnerton
Copy link
Contributor

Adding support for this would be particularly helpful for holding the j or k keys when scrolling through a large command output like git diff.

@Kristoffer
Copy link

Kristoffer commented Jan 21, 2024

This also affects running vi and vim in terminal, which causes arrowkeys (h j k l) to not perform as expected, for instance showing the possiblity of inserting a ķ instead of moving cursor up.
This happens on os x 14.2.1, US english.

@mrnugget
Copy link
Member

Do you have concrete steps to reproduce? I have Vim mode enabled in Zed and can hold down j to scroll down the buffer. I can do the same thing inside the built-in terminal: keep typing j in the shell, or scroll in Vim inside that built-in terminal.

screenshot-2024-01-22-09.26.12.mp4

Do you use this setting too?

defaults write -g ApplePressAndHoldEnabled -bool false

That disables press-and-hold to type special characters.

(Doesn't mean that users should have to use that to make it work in Zed, but just trying to find out why it works for me and not for you)

@Kristoffer
Copy link

Kristoffer commented Jan 22, 2024

aha, that works, to disable ApplePressAndHoldEnabled.

So to me it looks like vi and vim in

  • OSX terminal
  • iTerm2
  • Zed
  • VSCode

bypasses ApplePressAndHoldEnabled when in VI mode.

But the Zed terminal does not.

I see I'm actually using en_DK, from defaults read -g if that has any relevance:

    AKLastLocale = "en_DK";
    AppleInterfaceStyleSwitchesAutomatically = 1;
    AppleKeyboardUIMode = 3;
    AppleLanguages =     (
        "en-DK"
    );
    AppleLanguagesDidMigrate = "13.4.1";
    AppleLanguagesSchemaVersion = 4000;
    AppleLocale = "en_DK";
    AppleMenuBarVisibleInFullscreen = 0;
    AppleMiniaturizeOnDoubleClick = 0;
    ApplePressAndHoldEnabled = 0;
    AppleShowAllExtensions = 1;
    InitialKeyRepeat = 15;
    "KB_DoubleQuoteOption" = "\\U201cabc\\U201d";
    "KB_SingleQuoteOption" = "\\U2018abc\\U2019";
    "KB_SpellingLanguage" =     {
        "KB_SpellingLanguageIsAutomatic" = 1;
    };
    KeyRepeat = 2;
    NSAutomaticCapitalizationEnabled = 0;
    NSAutomaticPeriodSubstitutionEnabled = 0;
    NSAutomaticSpellingCorrectionEnabled = 0;
    NSLinguisticDataAssetsRequestLastInterval = 86400;
    NSLinguisticDataAssetsRequestTime = "2024-01-21 14:51:34 +0000";
    NSLinguisticDataAssetsRequested =     (
        da,
        en,
        fr,
        nb,
        nn,
        de,
        sv,
        cs,
        nl,
        fi,
        it
    );
    NSLinguisticDataAssetsRequestedByChecker =     (
        da,
        en,
        fr,
        nb,
        nn,
        de,
        sv,
        cs,
        nl,
        fi,
        it
    );```

@mrnugget
Copy link
Member

bypasses ApplePressAndHoldEnabled when in VI mode.

But the Zed terminal does not.

Yeah, that's very interesting. Thanks for digging into this. We'll need to look into this a bit more.

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@ovidius72
Copy link

Do you have concrete steps to reproduce? I have Vim mode enabled in Zed and can hold down j to scroll down the buffer. I can do the same thing inside the built-in terminal: keep typing j in the shell, or scroll in Vim inside that built-in terminal.

screenshot-2024-01-22-09.26.12.mp4
Do you use this setting too?

defaults write -g ApplePressAndHoldEnabled -bool false

That disables press-and-hold to type special characters.

(Doesn't mean that users should have to use that to make it work in Zed, but just trying to find out why it works for me and not for you)

That's ok if you want to disable press and hold globally. I'd like to disable only for zed and its integrated terminal but while it just works for the editor, it does not for the terminal.

@mrnugget
Copy link
Member

I'd like to disable only for zed and its integrated terminal but while it just works for the editor, it does not for the terminal.

Can you clarify? You did disable it only for Zed? If so, how?

@ovidius72
Copy link

ovidius72 commented Jul 15, 2024

@mrnugget usually with vscode and jetbrains products i run the following command:

defaults write [app_id] ApplePressAndHoldEnabled -bool false

if you instead run:

defaults write -g ApplePressAndHoldEnabled -bool false (without specifying the app_id)

this will affects the feature globally and disable the hold and press feature for all apps. Most likely you want to keep this enabled for apps like office apps, pages, numbers, and so on, where i find it to be very handy.

So I did this for zed:

defaults write zed.Zed ApplePressAndHoldEnabled -bool false
and
defaults write zed.Zed-Preview ApplePressAndHoldEnabled -bool false

This turned out to disable press and hold when I'm in the editor panels, but did not in the terminal panels.

Most of the time I found it hard to find the app_id to be used.
Here is a useful post: https://stackoverflow.com/questions/33152551/how-can-i-disable-applepressandholdenabled-for-a-specific-application-repeat

@mrnugget
Copy link
Member

Thank you! That's very helpful.

@Calinou
Copy link

Calinou commented Jul 18, 2024

Note that this issue does not seem to affect Linux (X11) – key repetition works fine on my end in the terminal.

Zed: v0.143.7 (Zed)
OS: Linux X11 fedora 40
Memory: 62.5 GiB
Architecture: x86_64

@ovidius72
Copy link

Note that this issue does not seem to affect Linux (X11) – key repetition works fine on my end in the terminal.

Zed: v0.143.7 (Zed) OS: Linux X11 fedora 40 Memory: 62.5 GiB Architecture: x86_64

Yes. this is only a mac issue.

@brittlewis12
Copy link

After I hit this myself, I did a cursory search into how iTerm 2 handles this (in iTerm windows, I can hold motion keys (jk) and navigate a paged diff/file/etc; in Zed windows, the integrated terminal moves a single line and stops).

I'm not sure it's relevant, but I found this change: Add auto-repeat mode

Is it possible DECARM would improve or resolve the desired key repeat behavior for macOS?

There seems to be an equivalent change for microsoft terminal

This behavior doesn't affect Alacritty, so perhaps it's matter of configuration rather than outright support?

@failable failable changed the title Support keyboard repetition in terminal Support key repetition in terminal Oct 10, 2024
@esamattirs
Copy link

esamattirs commented Nov 6, 2024

So I did this for zed:

defaults write zed.Zed ApplePressAndHoldEnabled -bool false

For me I needed use dev.zed.Zed as the identifier for stable Zed (0.159.10)

defaults write dev.zed.Zed ApplePressAndHoldEnabled -bool false

For anyone wondering Karabiner EventViewer can be used to view the identifier

image

@ovidius72
Copy link

For me I needed use dev.zed.Zed as the identifier for stable Zed (0.159.10)

defaults write dev.zed.Zed ApplePressAndHoldEnabled -bool false

Great. For anyone using the preview release

defaults write dev.zed.Zed-Preview ApplePressAndHoldEnabled -bool false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] terminal Feedback for terminal integration, shell commands, etc
Projects
None yet
Development

No branches or pull requests

9 participants