Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search #277

Merged
merged 9 commits into from
Jun 10, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix insert mode
  • Loading branch information
johnfn committed Jun 10, 2016
commit 12c76a556c76a3f854e4d0917521a078d6f08106
11 changes: 9 additions & 2 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const controlKeys: string[] = [
"alt",
"shift",
"esc",
"enter",
"delete"
];

Expand Down Expand Up @@ -248,7 +247,15 @@ class CommandInsertInInsertMode extends BaseCommand {
keys = ["<character>"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await TextEditor.insert(vimState.actionState.actionKeys[0]);
const char = vimState.actionState.actionKeys[0];

if (char === "<enter>") {
await TextEditor.insert("\n");
} else if (char === "<backspace>") {
await TextEditor.delete(new vscode.Range(position, position.getLeft()));
} else {
await TextEditor.insert(char);
}

vimState.cursorStartPosition = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start);
vimState.cursorPosition = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start);
Expand Down