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

rename command mode to normal mode #34

Merged
merged 1 commit into from
Nov 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/mode/mode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum ModeName {
Command,
Normal,
Insert,
Visual,
}
Expand Down
8 changes: 4 additions & 4 deletions src/mode/mode_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as _ from 'lodash';
import * as vscode from 'vscode';

import {Mode, ModeName} from './mode';
import CommandMode from './mode_command';
import NormalMode from './mode_normal';
import InsertMode from './mode_insert';
import VisualMode from './mode_visual';

Expand All @@ -13,12 +13,12 @@ export default class ModeHandler {

constructor() {
this.modes = [
new CommandMode(),
new NormalMode(),
new InsertMode(),
new VisualMode(),
];

this.setCurrentModeByName(ModeName.Command);
this.setCurrentModeByName(ModeName.Normal);
}

get currentMode() : Mode {
Expand All @@ -34,7 +34,7 @@ export default class ModeHandler {
mode.IsActive = (mode.Name === modeName);
});

var statusBarText = (this.currentMode.Name === ModeName.Command) ? '' : ModeName[modeName];
var statusBarText = (this.currentMode.Name === ModeName.Normal) ? '' : ModeName[modeName];
this.setupStatusBarItem(statusBarText.toUpperCase());
}

Expand Down
2 changes: 1 addition & 1 deletion src/mode/mode_command.ts → src/mode/mode_normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as vscode from 'vscode';

export default class CommandMode extends Mode {
constructor() {
super(ModeName.Command);
super(ModeName.Normal);
}

ShouldBeActivated(key : string, currentMode : ModeName) : boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/mode/mode_visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class VisualMode extends Mode {

ShouldBeActivated(key : string, currentMode : ModeName) : boolean {
// TODO: improve this logic for "V".
return (key === "v" || key === "V") && (currentMode === ModeName.Command);
return (key === "v" || key === "V") && (currentMode === ModeName.Normal);
}

HandleActivation(key : string) : void {
Expand Down
6 changes: 3 additions & 3 deletions test/mode/mode_handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ suite("Mode Handler", () => {
test("ctor", () => {
var modeHandler = new ModeHandler();

assert.equal(modeHandler.currentMode.Name, ModeName.Command);
assert.equal(modeHandler.currentMode.Name, ModeName.Normal);
assert.equal(modeHandler.currentMode.IsActive, true);
});

test("can set current mode", () => {
var modeHandler = new ModeHandler();

modeHandler.setCurrentModeByName(ModeName.Command);
assert.equal(modeHandler.currentMode.Name, ModeName.Command);
modeHandler.setCurrentModeByName(ModeName.Normal);
assert.equal(modeHandler.currentMode.Name, ModeName.Normal);

modeHandler.setCurrentModeByName(ModeName.Insert);
assert.equal(modeHandler.currentMode.Name, ModeName.Insert);
Expand Down