When I'm in Terminal, I've noticed that pressing the . or numbers 0 through 9 produce the error sound and don't register a value.

The same keys pressed on the "regular" keyboard work as expected.

Is this the expected behavior?

** edit **

Those keys work in other applications.

When I start a new Terminal window or tab, these keys work correctly.

However, when I start PowerShell 7 (pwsh), typing 0-9 then . produce OpOqOrOsOtOuOvOwOxOyOn. When I exit pwsh, returning to zsh, and type those keys, the behavior reappears.

  • When in another app, like TextEdit, what happens when you press those keys. – Allan May 28 '20 at 22:15
  • The magic keyboard works with an iPad Pro - not a mac, so I’ll remove that unless you can edit to explain what app goes between iPadOS and macos to connect the keyboard. – bmike May 31 '20 at 19:28
  • 1
  • “When I'm in Terminal” Always? No matter what program you're interacting with? Or is this an issue with a specific program or shell? This is a known Vim bug, for example, and if you're using Zsh and Oh My Zsh you may find that OMZ causes this issue. – Chris Page Mar 18 at 0:09

Keypad Application Mode

Terminals have a feature named Keypad Application Mode (the mnemonic for the command that enables it is DECKPAM).

When Keypad Application Mode is enabled the numeric-keypad keys send function-key escape sequences so they can be differentiated from the digit keys along the top of the main keyboard and used to perform other functions (e.g., cursor movement, scrolling, editing text).

This mode is described in the DEC VT100 terminal user guide here:

DECKPAM – Keypad Application Mode

The input sequences are described in tables 3-7 and 3-8. (The specific sequences depend on other terminal state.)

Overriding to Enter Decimal Digits

Typically, a Num Lock key can be used to override this mode to enter digit characters, and several terminal emulators have a preference to ignore this mode and always send digits.

Since not all keyboards have a Num Lock key, macOS Terminal—for example—also has a Num Lock menu item and by default it maps the keypad Clear key (which is physically located where Num Lock often is) to Num Lock. The Num Lock menu item also has the keyboard shortcut Command-Clear ⌘⌧ to make it available from the keyboard if the Terminal keyboard-map preference has been customized and Clear does not map to Num Lock.

Programs That Cause Problems

By default, Vim enables Keypad Application Mode but does not map the function-key input to anything, which means that the trailing part of the function-key escape sequences are entered as text. Similarly, the Zsh “Oh My Zsh” collection may enable this mode without mapping the keys to something useful.

In programs like these you may see text entered or the program may beep and/or enter nothing. As far as I am aware this should be considered a bug in the program that enables the mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .