From 95c3ea1b74a7e64e08bbb6dc59afcf4cba485d6f Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 16 Jul 2012 10:29:14 -0700 Subject: [PATCH] Rename insert tab event to indent --- spec/app/edit-session-spec.coffee | 10 +++++----- spec/extensions/snippets-spec.coffee | 2 +- src/app/edit-session.coffee | 2 +- src/app/editor.coffee | 4 ++-- src/app/keymaps/editor.coffee | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 7eff8ae31..e529b1c56 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -1055,13 +1055,13 @@ describe "EditSession", -> editSession.deleteToEndOfWord() expect(buffer.lineForRow(1)).toBe ' var sort = function(it) {' - describe ".insertTab()", -> + describe ".indent()", -> describe "when nothing is selected", -> describe "if 'softTabs' is true (the default)", -> it "inserts the value of 'tabText' into the buffer", -> tabRegex = new RegExp("^#{editSession.tabText}") expect(buffer.lineForRow(0)).not.toMatch(tabRegex) - editSession.insertTab() + editSession.indent() expect(buffer.lineForRow(0)).toMatch(tabRegex) describe "when auto-indent is on and there is no text after the cursor", -> @@ -1070,7 +1070,7 @@ describe "EditSession", -> editSession.tabText = " " editSession.setCursorBufferPosition [7, 2] editSession.setAutoIndent(true) - editSession.insertTab() + editSession.indent() expect(buffer.lineForRow(7)).toMatch /^\s+$/ expect(buffer.lineForRow(7).length).toBe 6 expect(editSession.getCursorBufferPosition()).toEqual [7, 6] @@ -1079,12 +1079,12 @@ describe "EditSession", -> it "inserts a tab character into the buffer", -> editSession.setSoftTabs(false) expect(buffer.lineForRow(0)).not.toMatch(/^\t/) - editSession.insertTab() + editSession.indent() expect(buffer.lineForRow(0)).toMatch(/^\t/) expect(editSession.getCursorBufferPosition()).toEqual [0, 1] expect(editSession.getCursorScreenPosition()).toEqual [0, editSession.tabText.length] - editSession.insertTab() + editSession.indent() expect(buffer.lineForRow(0)).toMatch(/^\t\t/) expect(editSession.getCursorBufferPosition()).toEqual [0, 2] expect(editSession.getCursorScreenPosition()).toEqual [0, editSession.tabText.length * 2] diff --git a/spec/extensions/snippets-spec.coffee b/spec/extensions/snippets-spec.coffee index f56cf7a2e..68d9e0ed7 100644 --- a/spec/extensions/snippets-spec.coffee +++ b/spec/extensions/snippets-spec.coffee @@ -145,7 +145,7 @@ describe "Snippets extension", -> editor.insertText("xte") expect(editor.getCursorScreenPosition()).toEqual [0, 3] - editor.trigger 'tab' + editor.trigger keydownEvent('tab', target: editor[0]) expect(buffer.lineForRow(0)).toBe "xte var quicksort = function () {" expect(editor.getCursorScreenPosition()).toEqual [0, 5] diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index cc2556d2a..2a9718ae4 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -129,7 +129,7 @@ class EditSession @moveCursorToEndOfLine() @insertNewline() - insertTab: -> + indent: -> if @getSelection().isEmpty() whitespaceMatch = @lineForBufferRow(@getCursorBufferPosition().row).match /^\s*$/ if @autoIndent and whitespaceMatch diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 4d2b9f3b9..c71be0e67 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -105,7 +105,7 @@ class Editor extends View 'select-down': @selectDown 'select-word': @selectWord 'newline': @insertNewline - 'tab': @insertTab + 'indent': @indent 'indent-selected-rows': @indentSelectedRows 'outdent-selected-rows': @outdentSelectedRows 'backspace': @backspace @@ -211,7 +211,7 @@ class Editor extends View insertText: (text) -> @activeEditSession.insertText(text) insertNewline: -> @activeEditSession.insertNewline() insertNewlineBelow: -> @activeEditSession.insertNewlineBelow() - insertTab: -> @activeEditSession.insertTab() + indent: -> @activeEditSession.indent() indentSelectedRows: -> @activeEditSession.indentSelectedRows() outdentSelectedRows: -> @activeEditSession.outdentSelectedRows() cutSelection: -> @activeEditSession.cutSelectedText() diff --git a/src/app/keymaps/editor.coffee b/src/app/keymaps/editor.coffee index 4ff9ca96a..6bdce72c3 100644 --- a/src/app/keymaps/editor.coffee +++ b/src/app/keymaps/editor.coffee @@ -7,7 +7,7 @@ window.keymap.bindKeys '.editor', 'meta-a': 'select-all' 'enter': 'newline' 'meta-enter': 'newline-below' - 'tab': 'tab' + 'tab': 'indent' 'backspace': 'backspace' 'delete': 'delete' 'meta-x': 'cut'