Fix autocomplete hotkey in settings (Fixes #872)

This commit is contained in:
Gregory Schier
2018-04-25 13:52:13 -04:00
parent a9beae360e
commit a03b1546bf
3 changed files with 12 additions and 6 deletions

View File

@@ -8,7 +8,8 @@ export type Hotkey = {
meta: boolean,
alt: boolean,
shift: boolean,
keycode: number | Array<number>
keycode: number | Array<number>,
metaIsCtrl?: boolean,
};
export const SHOW_WORKSPACE_SETTINGS: Hotkey = {
@@ -70,6 +71,7 @@ export const RELOAD_PLUGINS: Hotkey = {
export const SHOW_AUTOCOMPLETE: Hotkey = {
description: 'Show Autocomplete',
meta: true,
metaIsCtrl: true,
alt: false,
shift: false,
keycode: keycodes.space

View File

@@ -49,7 +49,7 @@ const BASE_CODEMIRROR_OPTIONS = {
showCursorWhenSelecting: false,
cursorScrollMargin: 12, // NOTE: This is px
keyMap: 'default',
extraKeys: {
extraKeys: CodeMirror.normalizeKeyMap({
'Ctrl-Q': function (cm) {
cm.foldCode(cm.getCursor());
},
@@ -61,7 +61,7 @@ const BASE_CODEMIRROR_OPTIONS = {
// Change default find command from "find" to "findPersistent" so the
// search box stays open after pressing Enter
[isMac() ? 'Cmd-F' : 'Ctrl-F']: 'findPersistent'
}
})
};
@autobind

View File

@@ -15,14 +15,18 @@ type Props = {
class Hotkey extends React.PureComponent<Props> {
render () {
const {hotkey, className} = this.props;
const {alt, shift, meta} = hotkey;
const chars = [ ];
const {alt, shift, meta, metaIsCtrl} = hotkey;
const chars = [];
alt && chars.push(ALT_SYM);
shift && chars.push(SHIFT_SYM);
if (meta) {
chars.push(isMac() ? MOD_SYM : CTRL_SYM);
if (metaIsCtrl) {
chars.push(CTRL_SYM);
} else {
chars.push(isMac() ? MOD_SYM : CTRL_SYM);
}
}
chars.push(hotkeys.getChar(hotkey));