mirror of https://github.com/getcursor/cursor
Fix problems with keybindings
parent
5d5df0ba25
commit
14de668ddb
|
@ -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'))
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -316,7 +316,7 @@ const createWindow = () => {
|
|||
click: () => {
|
||||
main_window.webContents.send('commandPalette')
|
||||
},
|
||||
accelerator: 'cmd+shift+p',
|
||||
accelerator: META_KEY + '+shift+p',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue