From a274ea6645f131a1c344b2b5bc396a6bc6278a06 Mon Sep 17 00:00:00 2001 From: Scott Bronson Date: Tue, 21 Jul 2015 00:05:51 -0700 Subject: [PATCH 1/2] fix some more command->normal mode renames --- docs/operators.md | 2 +- spec/motions-spec.coffee | 42 +++++++++++++++++++------------------- spec/vim-state-spec.coffee | 10 ++++----- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/operators.md b/docs/operators.md index 63d45484..f8f0a9b6 100644 --- a/docs/operators.md +++ b/docs/operators.md @@ -15,7 +15,7 @@ * `c2c` - repeated linewise * `C` - change to the end of the line * [Adding and subtracting](http://vimhelp.appspot.com/change.txt.html#CTRL-A) - * `ctrl-a` and `ctrl-x` in command mode to increase/decrease numbers in text + * `ctrl-a` and `ctrl-x` in normal mode to increase/decrease numbers in text * [Yank](http://vimhelp.appspot.com/change.txt.html#yank) * `vwy` - works in visual mode * `yw` - with a motion diff --git a/spec/motions-spec.coffee b/spec/motions-spec.coffee index 7684360e..1b137317 100644 --- a/spec/motions-spec.coffee +++ b/spec/motions-spec.coffee @@ -22,9 +22,9 @@ describe "Motions", -> editor.normalModeInputView.editorElement.getModel().setText(key) submitNormalModeInputText = (text) -> - commandEditor = editor.normalModeInputView.editorElement - commandEditor.getModel().setText(text) - atom.commands.dispatch(commandEditor, "core:confirm") + normalEditor = editor.normalModeInputView.editorElement + normalEditor.getModel().setText(text) + atom.commands.dispatch(normalEditor, "core:confirm") describe "simple motions", -> beforeEach -> @@ -850,7 +850,7 @@ describe "Motions", -> editor.setCursorScreenPosition([0, 2]) describe "as a motion", -> - describe "in command mode", -> + describe "in normal mode", -> beforeEach -> keydown('g') keydown('g') @@ -885,7 +885,7 @@ describe "Motions", -> expect(editor.getCursorScreenPosition()).toEqual [0, 1] describe "as a repeated motion", -> - describe "in command mode", -> + describe "in normal mode", -> beforeEach -> keydown('2') keydown('g') @@ -1189,7 +1189,7 @@ describe "Motions", -> expect(editor.getCursorBufferPosition()).toEqual [1, 0] describe "using search history", -> - commandEditor = null + normalEditor = null beforeEach -> keydown('/') @@ -1200,27 +1200,27 @@ describe "Motions", -> submitNormalModeInputText('abc') expect(editor.getCursorBufferPosition()).toEqual [2, 0] - commandEditor = editor.normalModeInputView.editorElement + normalEditor = editor.normalModeInputView.editorElement it "allows searching history in the search field", -> keydown('/') - atom.commands.dispatch(commandEditor, 'core:move-up') - expect(commandEditor.getModel().getText()).toEqual('abc') - atom.commands.dispatch(commandEditor, 'core:move-up') - expect(commandEditor.getModel().getText()).toEqual('def') - atom.commands.dispatch(commandEditor, 'core:move-up') - expect(commandEditor.getModel().getText()).toEqual('def') + atom.commands.dispatch(normalEditor, 'core:move-up') + expect(normalEditor.getModel().getText()).toEqual('abc') + atom.commands.dispatch(normalEditor, 'core:move-up') + expect(normalEditor.getModel().getText()).toEqual('def') + atom.commands.dispatch(normalEditor, 'core:move-up') + expect(normalEditor.getModel().getText()).toEqual('def') it "resets the search field to empty when scrolling back", -> keydown('/') - atom.commands.dispatch(commandEditor, 'core:move-up') - expect(commandEditor.getModel().getText()).toEqual('abc') - atom.commands.dispatch(commandEditor, 'core:move-up') - expect(commandEditor.getModel().getText()).toEqual('def') - atom.commands.dispatch(commandEditor, 'core:move-down') - expect(commandEditor.getModel().getText()).toEqual('abc') - atom.commands.dispatch(commandEditor, 'core:move-down') - expect(commandEditor.getModel().getText()).toEqual '' + atom.commands.dispatch(normalEditor, 'core:move-up') + expect(normalEditor.getModel().getText()).toEqual('abc') + atom.commands.dispatch(normalEditor, 'core:move-up') + expect(normalEditor.getModel().getText()).toEqual('def') + atom.commands.dispatch(normalEditor, 'core:move-down') + expect(normalEditor.getModel().getText()).toEqual('abc') + atom.commands.dispatch(normalEditor, 'core:move-down') + expect(normalEditor.getModel().getText()).toEqual '' describe "the * keybinding", -> beforeEach -> diff --git a/spec/vim-state-spec.coffee b/spec/vim-state-spec.coffee index 7be6be15..67ea747d 100644 --- a/spec/vim-state-spec.coffee +++ b/spec/vim-state-spec.coffee @@ -198,14 +198,14 @@ describe "VimState", -> it "allows the cursor to be placed on the \n character", -> expect(editor.getCursorScreenPosition()).toEqual [0, 6] - it "puts the editor into command mode when is pressed", -> + it "puts the editor into normal mode when is pressed", -> keydown('escape') expect(editorElement.classList.contains('normal-mode')).toBe(true) expect(editorElement.classList.contains('insert-mode')).toBe(false) expect(editorElement.classList.contains('visual-mode')).toBe(false) - it "puts the editor into command mode when is pressed", -> + it "puts the editor into normal mode when is pressed", -> helpers.mockPlatform(editorElement, 'platform-darwin') keydown('c', ctrl: true) helpers.unmockPlatform(editorElement) @@ -224,14 +224,14 @@ describe "VimState", -> expect(editor.getSelectedBufferRanges()).toEqual [[[0, 4], [0, 5]]] expect(editor.getSelectedText()).toBe("t") - it "puts the editor into command mode when is pressed", -> + it "puts the editor into normal mode when is pressed", -> keydown('escape') expect(editor.getCursorBufferPositions()).toEqual [[0, 4]] expect(editorElement.classList.contains('normal-mode')).toBe(true) expect(editorElement.classList.contains('visual-mode')).toBe(false) - it "puts the editor into command mode when is pressed on selection is reversed", -> + it "puts the editor into normal mode when is pressed on selection is reversed", -> expect(editor.getSelectedText()).toBe("t") keydown("h") keydown("h") @@ -308,7 +308,7 @@ describe "VimState", -> expect(vimState.mode).toEqual 'normal' expect(editorElement.classList.contains('normal-mode')).toBe(true) - it "activateVisualMode with same type puts the editor into command mode", -> + it "activateVisualMode with same type puts the editor into normal mode", -> keydown('v') expect(editorElement.classList.contains('visual-mode')).toBe(true) expect(vimState.submode).toEqual 'characterwise' From aed24346aa03edad30805cfae208f6e3891d5584 Mon Sep 17 00:00:00 2001 From: Scott Bronson Date: Tue, 21 Jul 2015 08:15:17 -0700 Subject: [PATCH 2/2] rename normalEditor->inputEditor: more descriptive --- spec/motions-spec.coffee | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/spec/motions-spec.coffee b/spec/motions-spec.coffee index 1b137317..58d30bd7 100644 --- a/spec/motions-spec.coffee +++ b/spec/motions-spec.coffee @@ -22,9 +22,9 @@ describe "Motions", -> editor.normalModeInputView.editorElement.getModel().setText(key) submitNormalModeInputText = (text) -> - normalEditor = editor.normalModeInputView.editorElement - normalEditor.getModel().setText(text) - atom.commands.dispatch(normalEditor, "core:confirm") + inputEditor = editor.normalModeInputView.editorElement + inputEditor.getModel().setText(text) + atom.commands.dispatch(inputEditor, "core:confirm") describe "simple motions", -> beforeEach -> @@ -1189,7 +1189,7 @@ describe "Motions", -> expect(editor.getCursorBufferPosition()).toEqual [1, 0] describe "using search history", -> - normalEditor = null + inputEditor = null beforeEach -> keydown('/') @@ -1200,27 +1200,27 @@ describe "Motions", -> submitNormalModeInputText('abc') expect(editor.getCursorBufferPosition()).toEqual [2, 0] - normalEditor = editor.normalModeInputView.editorElement + inputEditor = editor.normalModeInputView.editorElement it "allows searching history in the search field", -> keydown('/') - atom.commands.dispatch(normalEditor, 'core:move-up') - expect(normalEditor.getModel().getText()).toEqual('abc') - atom.commands.dispatch(normalEditor, 'core:move-up') - expect(normalEditor.getModel().getText()).toEqual('def') - atom.commands.dispatch(normalEditor, 'core:move-up') - expect(normalEditor.getModel().getText()).toEqual('def') + atom.commands.dispatch(inputEditor, 'core:move-up') + expect(inputEditor.getModel().getText()).toEqual('abc') + atom.commands.dispatch(inputEditor, 'core:move-up') + expect(inputEditor.getModel().getText()).toEqual('def') + atom.commands.dispatch(inputEditor, 'core:move-up') + expect(inputEditor.getModel().getText()).toEqual('def') it "resets the search field to empty when scrolling back", -> keydown('/') - atom.commands.dispatch(normalEditor, 'core:move-up') - expect(normalEditor.getModel().getText()).toEqual('abc') - atom.commands.dispatch(normalEditor, 'core:move-up') - expect(normalEditor.getModel().getText()).toEqual('def') - atom.commands.dispatch(normalEditor, 'core:move-down') - expect(normalEditor.getModel().getText()).toEqual('abc') - atom.commands.dispatch(normalEditor, 'core:move-down') - expect(normalEditor.getModel().getText()).toEqual '' + atom.commands.dispatch(inputEditor, 'core:move-up') + expect(inputEditor.getModel().getText()).toEqual('abc') + atom.commands.dispatch(inputEditor, 'core:move-up') + expect(inputEditor.getModel().getText()).toEqual('def') + atom.commands.dispatch(inputEditor, 'core:move-down') + expect(inputEditor.getModel().getText()).toEqual('abc') + atom.commands.dispatch(inputEditor, 'core:move-down') + expect(inputEditor.getModel().getText()).toEqual '' describe "the * keybinding", -> beforeEach ->