дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 09:41:34 +02:00
A keyToEx mapping such as `nnoremap gd <Action>(GotoDeclaration)` ran its Ex command without clearing the input state, so the typed keys stayed in the Vim status and the destination editor drew the half-height pending cursor until the next command. The mapped Ex command now ends the command the same way the `:` prompt does. Covers every keyToEx mapping (<Action>(...), :action ...<CR>, :w<CR>-style). Closes #8128 Co-authored-by: aliatli <[email protected]>
52 рядки
3.0 KiB
Diff
52 рядки
3.0 KiB
Diff
diff --git a/vim.js b/vim.js
|
|
--- a/vim.js
|
|
+++ b/vim.js
|
|
@@ -236,6 +236,8 @@
|
|
{ keys: '"<register>', type: 'action', action: 'setRegister' },
|
|
{ keys: '<C-r><register>', type: 'action', action: 'insertRegister', context: 'insert', isEdit: true },
|
|
{ keys: '<C-o>', type: 'action', action: 'oneNormalCommand', context: 'insert' },
|
|
+ // OpenIDEA: insert-mode undo break; the host defines this action.
|
|
+ { keys: '<C-g>u', type: 'action', action: 'openideaUndoBreak', context: 'insert' },
|
|
{ keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }},
|
|
{ keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
|
|
{ keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }},
|
|
@@ -248,6 +250,11 @@
|
|
{ keys: '<C-t>', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' },
|
|
{ keys: '<C-d>', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' },
|
|
// Text object motions
|
|
+ // OpenIDEA: function text objects; the host defines the motion. Built in, so a noremap's keys reach them.
|
|
+ { keys: 'af', type: 'motion', motion: 'openideaFunction', context: 'operatorPending' },
|
|
+ { keys: 'if', type: 'motion', motion: 'openideaFunction', motionArgs: { textObjectInner: true }, context: 'operatorPending' },
|
|
+ { keys: 'af', type: 'motion', motion: 'openideaFunction', context: 'visual' },
|
|
+ { keys: 'if', type: 'motion', motion: 'openideaFunction', motionArgs: { textObjectInner: true }, context: 'visual' },
|
|
{ keys: 'a<register>', type: 'motion', motion: 'textObjectManipulation' },
|
|
{ keys: 'i<register>', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }},
|
|
// Search
|
|
@@ -1974,6 +1981,8 @@
|
|
if (command.type == 'keyToEx') {
|
|
// Handle user defined Ex to Ex mappings
|
|
exCommandDispatcher.processCommand(cm, command.exArgs.input);
|
|
+ // OpenIDEA: end the command like the `:` prompt does, so the typed keys leave the status.
|
|
+ if (cm.state.vim) clearInputState(cm);
|
|
} else {
|
|
/**@type{import("./types").PromptOptions} */
|
|
var promptOptions = {
|
|
@@ -2582,6 +2591,8 @@
|
|
if (head.sticky == "before") head.ch--;
|
|
return head;
|
|
},
|
|
+ // OpenIDEA: the host overrides this with the function text object.
|
|
+ openideaFunction: function(cm, head) { return head; },
|
|
textObjectManipulation: function(cm, head, motionArgs, vim) {
|
|
// TODO: lots of possible exceptions that can be thrown here. Try da(
|
|
// outside of a () block.
|
|
@@ -3423,6 +3434,8 @@
|
|
cm.replaceSelection(text);
|
|
}
|
|
},
|
|
+ // OpenIDEA: the host overrides this with the undo-break implementation.
|
|
+ openideaUndoBreak: function() {},
|
|
oneNormalCommand: function(cm, actionArgs, vim) {
|
|
exitInsertMode(cm, true);
|
|
vim.insertModeReturn = true;
|