Fix problems with keybindings

pull/189/head
Michael Truell 2023-03-23 10:53:57 -07:00
parent 5d5df0ba25
commit 14de668ddb
3 changed files with 15 additions and 6 deletions

View File

@ -228,7 +228,8 @@ export function App() {
(e: KeyboardEvent) => {
const AI_KEYS = ['k', 'l', 'Backspace', 'Enter']
//
if (e.metaKey) {
const isControl = connector.PLATFORM_CM_KEY === 'Ctrl'
if ((isControl && e.ctrlKey) || (!isControl && e.metaKey)) {
if (AI_KEYS.includes(e.key)) {
if (e.shiftKey && e.key == 'Enter') {
dispatch(ct.pressAICommand('Shift-Enter'))

View File

@ -1228,11 +1228,19 @@ export const pressAICommand = createAsyncThunk(
case 'k':
if (chatState.chatIsOpen && lastBotMessage?.finished) {
if (editorView) {
// When there is an editorView, we dispatch something
dispatch(changeMsgType('chat_edit'))
dispatch(changeDraftMsgType('chat_edit'))
// Check if editorView in focus
if (!editorView.hasFocus) {
// When there is an editorView not in focus, we dispatch this
dispatch(changeMsgType('chat_edit'))
dispatch(changeDraftMsgType('chat_edit'))
return
}
}
} else if (editorView) {
// Close the chat if the chat is open then
dispatch(setChatOpen(false))
}
if (editorView) {
const selPos = getSelectedPos(editorView)
const selection = editorView.state.selection.main
editorView.dispatch({

View File

@ -316,7 +316,7 @@ const createWindow = () => {
click: () => {
main_window.webContents.send('commandPalette')
},
accelerator: 'cmd+shift+p',
accelerator: META_KEY + '+shift+p',
},
],
},