Skip to content

Commit

Permalink
Update useInput() to include name in key
Browse files Browse the repository at this point in the history
Some key values (e.g. 'insert', 'home', 'end') were basically lost. In
these cases, the `input` value would be an empty string and the
generated `key` data would contain no additional information about the
value.

To resolve this, directly include `keypress.name` in the generated `key`
data so this information is not lost.
  • Loading branch information
depeele committed Sep 26, 2024
1 parent 73795c4 commit 2e266e1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/hooks/use-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const useInput = (inputHandler: Handler, options: Options = {}) => {
const keypress = parseKeypress(data);

const key = {
name: keypress.name,
upArrow: keypress.name === 'up',
downArrow: keypress.name === 'down',
leftArrow: keypress.name === 'left',
Expand Down

0 comments on commit 2e266e1

Please sign in to comment.