Skip to content

Commit

Permalink
Fixes #1763 and unfixes #612 (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 26, 2017
1 parent e1caadf commit 5413d5e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
{
"key": "tab",
"command": "extension.vim_tab",
"when": "editorFocus && vim.active && !suggestWidgetVisible && !inDebugRepl"
"when": "editorFocus && vim.active && !inDebugRepl"
},
{
"key": "ctrl+r",
Expand Down
30 changes: 17 additions & 13 deletions src/actions/commands/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,23 @@ class CommandInsertIndentInCurrentLine extends BaseCommand {
}
}

@RegisterAction
export class CommandInsertTabInInsertMode extends BaseCommand {
modes = [ModeName.Insert];
keys = ["<tab>"];
runsOnceForEveryCursor() { return false; }

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.recordedState.transformations.push({
type: "tab"
});
return vimState;
}
}
// Upon thinking about it some more, I'm not really sure how to fix this
// elegantly. Tab is just used for so many things in the VSCode editor, and all
// of them happen to be overloaded. Sometimes tab does a tab, sometimes it does
// an emmet completion, sometimes a snippet completion, etc.
// @RegisterAction
// export class CommandInsertTabInInsertMode extends BaseCommand {
// modes = [ModeName.Insert];
// keys = ["<tab>"];
// runsOnceForEveryCursor() { return false; }

// public async exec(position: Position, vimState: VimState): Promise<VimState> {
// vimState.recordedState.transformations.push({
// type: "tab"
// });
// return vimState;
// }
// }

@RegisterAction
export class CommandInsertInInsertMode extends BaseCommand {
Expand Down
3 changes: 0 additions & 3 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1450,9 +1450,6 @@ export class ModeHandler implements vscode.Disposable {
this._vimState.editor.selection = new vscode.Selection(newPos, newPos);
break;
case "tab":
// Temporary fix for #1763.
// TODO: Investigate into how to handle tab correctly
await vscode.commands.executeCommand('editor.emmet.action.expandAbbreviation');
await vscode.commands.executeCommand('tab');
if (command.diff) {
if (command.cursorIndex === undefined) {
Expand Down
13 changes: 7 additions & 6 deletions test/mode/normalModeTests/motions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,13 @@ suite("Motions in Normal Mode", () => {
end: ['!one', '!two', '|!three']
});

newTest({
title: "Can handle dot with I with tab",
start: ['on|e', 'two', 'three'],
keysPressed: 'I<tab><Esc>j.j.',
end: [' one', ' two', ' | three']
});
// This is still currently not possible.
// newTest({
// title: "Can handle dot with I with tab",
// start: ['on|e', 'two', 'three'],
// keysPressed: 'I<tab><Esc>j.j.',
// end: [' one', ' two', ' | three']
// });

newTest({
title: "Can handle 0",
Expand Down

0 comments on commit 5413d5e

Please sign in to comment.