Rename insert tab event to indent

This commit is contained in:
Corey Johnson
2012-07-16 10:29:14 -07:00
parent 453af489d9
commit 95c3ea1b74
5 changed files with 10 additions and 10 deletions

View File

@@ -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]

View File

@@ -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]

View File

@@ -129,7 +129,7 @@ class EditSession
@moveCursorToEndOfLine()
@insertNewline()
insertTab: ->
indent: ->
if @getSelection().isEmpty()
whitespaceMatch = @lineForBufferRow(@getCursorBufferPosition().row).match /^\s*$/
if @autoIndent and whitespaceMatch

View File

@@ -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()

View File

@@ -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'