Skip to content

Commit

Permalink
'C-g' should cancel long keybinding in progress (if any).
Browse files Browse the repository at this point in the history
Quick fix for issue hiro-sun#30.
Known issues:
1. Generally, 'C-g' should be pressed twice. This is connected with curios
current behavior: whenever there is an active selection, pressing 'Ctrl+g'
for the first time clears up the selection, but extension does not receive
neither 'C-g', nor 'Type' command. Pressing 'Ctrl+g' for the second time
generates 'C-g' command.
2. Unlike Emacs, this extension does not preserve current selection on
pressing 'Ctrl+g'.
TODO:
Investigate this situation in more details. Is it VSCode designed behavior?
  • Loading branch information
okia committed Nov 17, 2016
1 parent a0220bb commit 7fac404
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export class Editor {
});
}

onCancel() : void {
this.keybindProgressMode = KeybindProgressMode.None; // cancel long keybinding in progress (if any)
this.setStatusBarPermanentMessage("");
this.setStatusBarMessage("Quit");
}

setStatusBarMessage(text: string): vscode.Disposable {
return vscode.window.setStatusBarMessage(text, 1000);
}
Expand Down
2 changes: 1 addition & 1 deletion src/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Operation {
this.editor.setStatusBarMessage("Undo!");
},
'C-g': () => {
this.editor.setStatusBarMessage("Quit");
this.editor.onCancel();
},
"C-x_r": () => {
this.editor.setRMode();
Expand Down

0 comments on commit 7fac404

Please sign in to comment.