From 479cac704eebd44636056adca0381fc407136127 Mon Sep 17 00:00:00 2001 From: Jason Poon Date: Wed, 25 Nov 2015 12:27:19 -0800 Subject: [PATCH] rename command mode to normal mode --- src/mode/mode.ts | 2 +- src/mode/mode_handler.ts | 8 ++++---- src/mode/{mode_command.ts => mode_normal.ts} | 2 +- src/mode/mode_visual.ts | 2 +- test/mode/mode_handler.test.ts | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) rename src/mode/{mode_command.ts => mode_normal.ts} (93%) diff --git a/src/mode/mode.ts b/src/mode/mode.ts index 08f6b006094..565ce3338b4 100644 --- a/src/mode/mode.ts +++ b/src/mode/mode.ts @@ -1,5 +1,5 @@ export enum ModeName { - Command, + Normal, Insert, Visual, } diff --git a/src/mode/mode_handler.ts b/src/mode/mode_handler.ts index 51b6f04e36e..24947710337 100644 --- a/src/mode/mode_handler.ts +++ b/src/mode/mode_handler.ts @@ -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'; @@ -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 { @@ -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()); } diff --git a/src/mode/mode_command.ts b/src/mode/mode_normal.ts similarity index 93% rename from src/mode/mode_command.ts rename to src/mode/mode_normal.ts index 7717d111077..7bb4c50ca57 100644 --- a/src/mode/mode_command.ts +++ b/src/mode/mode_normal.ts @@ -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 { diff --git a/src/mode/mode_visual.ts b/src/mode/mode_visual.ts index 33bdb03c443..c87a61ce404 100644 --- a/src/mode/mode_visual.ts +++ b/src/mode/mode_visual.ts @@ -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 { diff --git a/test/mode/mode_handler.test.ts b/test/mode/mode_handler.test.ts index 83221ea4a70..d818957638c 100644 --- a/test/mode/mode_handler.test.ts +++ b/test/mode/mode_handler.test.ts @@ -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);