aboutsummaryrefslogtreecommitdiff
path: root/src/actions/input.js
blob: 61acb76e06febc750b01ae9aa2a78aa0d042a304 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import actions from 'actions';

const asKeymapChars = (key, ctrl) => {
  if (ctrl) {
    return '<C-' + key.toUpperCase() + '>';
  }
  return key;
};

const keyPress = (key, ctrl) => {
  return {
    type: actions.INPUT_KEY_PRESS,
    key: asKeymapChars(key, ctrl),
  };
};

const clearKeys = () => {
  return {
    type: actions.INPUT_CLEAR_KEYS
  };
};

export { keyPress, clearKeys };