ink icon indicating copy to clipboard operation
ink copied to clipboard

useInput meta + delete key combo missing delete flag

Open HenrySeed opened this issue 3 years ago • 2 comments

When pressing delete and meta key (in this case cmd key on macOS) the key object from useInput is missing the delete flag.

Is this expected behaviour? I would expect the delete flag to be true both times as it is being pressed both times

Example:

Regular Delete (backspace on macOS) press

{
    "upArrow": false,
    "downArrow": false,
    "leftArrow": false,
    "rightArrow": false,
    "pageDown": false,
    "pageUp": false,
    "return": false,
    "escape": false,
    "ctrl": false,
    "shift": false,
    "tab": false,
    "backspace": false,
    "delete": true,
    "meta": false
}

Delete while holding Meta key

{
    "upArrow": false,
    "downArrow": false,
    "leftArrow": false,
    "rightArrow": false,
    "pageDown": false,
    "pageUp": false,
    "return": false,
    "escape": false,
    "ctrl": false,
    "shift": false,
    "tab": false,
    "backspace": false,
    "delete": false,
    "meta": true
}```

HenrySeed avatar Mar 15 '21 04:03 HenrySeed

Also adding additional key combos not handled, like ctrl+return and shift+return. I think the input handling cribbed from the keypress module is not so sound, and that repo seems abandoned.

rektdeckard avatar Apr 11 '21 06:04 rektdeckard

This is certainly a bug, I'd appreciate a PR with a fix for this if you're in the mood for it ;)

vadimdemedes avatar Apr 15 '21 18:04 vadimdemedes

I gave it a shot today and turns out cmd + delete doesn't trigger any input whatsoever in iTerm or in built-in Terminal app. And ctrl + return and shift + return always trigger \r, which is a regular return, so it's impossible to detect if ctrl or shift was pressed.

Going to close this for now unless there's more information I'm missing.

vadimdemedes avatar Apr 01 '23 07:04 vadimdemedes