diff --git a/build/package.json b/build/package.json index 6961520fd..544b99fbc 100644 --- a/build/package.json +++ b/build/package.json @@ -20,6 +20,7 @@ "grunt-download-atom-shell": "git+https://atom-bot:362295be4c5258d3f7b967bbabae662a455ca2a7@github.com/atom/grunt-download-atom-shell#v0.5.0", "grunt-lesslint": "0.13.0", "grunt-markdown": "~0.4.0", + "grunt-peg": "~1.1.0", "grunt-shell": "~0.3.1", "harmony-collections": "~0.3.8", "js-yaml": "~2.1.0", @@ -29,7 +30,6 @@ "rimraf": "~2.2.2", "unzip": "~0.1.9", "vm-compatibility-layer": "~0.1.0", - "walkdir": "0.0.7", - "grunt-peg": "~1.1.0" + "walkdir": "0.0.7" } } diff --git a/package.json b/package.json index 4ae171833..dd4ddf735 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "clear-cut": "0.2.0", "coffee-script": "1.6.3", "coffeestack": "0.6.0", + "delegato": "~0.4.0", "emissary": "0.31.0", "first-mate": "0.17.0", "fs-plus": "0.14.0", @@ -34,25 +35,24 @@ "mkdirp": "0.3.5", "keytar": "0.15.1", "less-cache": "0.10.0", - "serializable": "0.3.0", + "mixto": "~0.4.0", "nslog": "0.3.0", "oniguruma": "0.26.0", "optimist": "0.4.0", "pathwatcher": "0.14.2", "pegjs": "0.8.0", + "property-accessors": "~0.1.0", "q": "0.9.7", "scandal": "0.13.0", "season": "0.14.0", "semver": "1.1.4", + "serializable": "0.3.0", "space-pen": "3.1.0", "temp": "0.5.0", "text-buffer": "0.13.0", - "underscore-plus": "0.6.1", - "vm-compatibility-layer": "0.1.0", "theorist": "~0.14.0", - "delegato": "~0.4.0", - "mixto": "~0.4.0", - "property-accessors": "~0.1.0" + "underscore-plus": "0.6.1", + "vm-compatibility-layer": "0.1.0" }, "packageDependencies": { "atom-dark-syntax": "0.10.0", diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 96bca8bf3..ecd6e6d7a 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -2722,6 +2722,15 @@ describe "Editor", -> editor.moveCursorLeft() expect(editor.getCursorBufferPosition()).toEqual [0, 0] + describe ".setIndentationForBufferRow", -> + describe "when the editor uses soft tabs but the row has hard tabs", -> + it "only replaces whitespace charachters", -> + editor.setSoftWrap(true) + editor.setText(" 1\n 2") + editor.setCursorBufferPosition([0, 0]) + editor.setIndentationForBufferRow(0, 2) + expect(editor.getText()).toBe(" 1\n 2") + describe "when the editor's grammar has an injection selector", -> beforeEach -> atom.packages.activatePackage('language-text', sync: true) diff --git a/src/editor.coffee b/src/editor.coffee index 40615a4bf..698030e90 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -269,10 +269,9 @@ class Editor extends Model # * newLevel: # A {Number} indicating the new indentation level. setIndentationForBufferRow: (bufferRow, newLevel) -> - currentLevel = @indentationForBufferRow(bufferRow) - currentIndentString = @buildIndentString(currentLevel) + currentIndentLength = @lineForBufferRow(bufferRow).match(/^\s*/)[0].length newIndentString = @buildIndentString(newLevel) - @buffer.change([[bufferRow, 0], [bufferRow, currentIndentString.length]], newIndentString) + @buffer.change([[bufferRow, 0], [bufferRow, currentIndentLength]], newIndentString) # Public: Returns the indentation level of the given line of text. #