Skip to content

Commit

Permalink
Delegate everything back to Code if it's Insert Mode and Multi Cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Oct 20, 2016
1 parent e89d847 commit 806c544
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ export async function activate(context: vscode.ExtensionContext) {
promise: async () => {
const mh = await getAndUpdateModeHandler();

if (mh.vimState.isMultiCursor && mh.vimState.currentMode === ModeName.Insert) {
await vscode.commands.executeCommand('default:type', args);
return;
}

if (compositionState.isInComposition) {
compositionState.composingText += args.text;
} else {
Expand All @@ -179,6 +184,11 @@ export async function activate(context: vscode.ExtensionContext) {
promise: async () => {
const mh = await getAndUpdateModeHandler();

if (mh.vimState.isMultiCursor && mh.vimState.currentMode === ModeName.Insert) {
await vscode.commands.executeCommand('default:replacePreviousChar', args);
return;
}

if (compositionState.isInComposition) {
compositionState.composingText = compositionState.composingText.substr(0, compositionState.composingText.length - args.replaceCharCnt) + args.text;
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{
"key": "Backspace",
"command": "extension.vim_backspace",
"when": "editorTextFocus && !inDebugRepl"
"when": "editorTextFocus && !inDebugRepl && !vim.multiCursorSlient"
},
{
"key": "Delete",
Expand Down
2 changes: 2 additions & 0 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,8 @@ export class ModeHandler implements vscode.Disposable {
vscode.commands.executeCommand('setContext', 'vim.mode', this.currentMode.text);
vscode.commands.executeCommand('setContext', 'vim.useCtrlKeys', Configuration.getInstance().useCtrlKeys);
vscode.commands.executeCommand('setContext', 'vim.platform', process.platform);
vscode.commands.executeCommand('setContext', 'vim.multiCursorSlient',
this.vimState.isMultiCursor && this.vimState.currentMode === ModeName.Insert);
}

async handleMultipleKeyEvents(keys: string[]): Promise<void> {
Expand Down

0 comments on commit 806c544

Please sign in to comment.