           config.set("editor.autoIndentOnPaste", true)
           editSession.pasteText()
           expect(editSession.lineForBufferRow(10)).toBe "  var number"
+
+    it "autoIndentSelectedRows auto-indents the selection", ->
+      editSession.setCursorBufferPosition([2, 0])
+      editSession.insertText("function() {\ninside=true\n}\n  i=1\n")
+      editSession.getSelection().setBufferRange([[2,0], [6,0]])
+      editSession.autoIndentSelectedRows()
+
+      expect(editSession.lineForBufferRow(2)).toBe "    function() {"
+      expect(editSession.lineForBufferRow(3)).toBe "      inside=true"
+      expect(editSession.lineForBufferRow(4)).toBe "    }"
+      expect(editSession.lineForBufferRow(5)).toBe "    i=1"
 
   describe ".autoDecreaseIndentForRow()", ->
       it "doesn't outdent the first and only row", ->

          editSession.indent()
          expect(editSession.lineForBufferRow(2)).toBe "   "

      it "auto-indents newlines if editor.autoIndent is true", ->
        config.set("editor.autoIndent", undefined)
        editSession.setCursorBufferPosition([1, 30])
        editSession.insertText("\n")
        expect(editSession.lineForBufferRow(2)).toBe "    "

      it "does not auto-indent newlines if editor.autoIndent is false", ->
        config.set("editor.autoIndent", false)
        editSession.setCursorBufferPosition([1, 30])
        editSession.insertText("\n")
        expect(editSession.lineForBufferRow(2)).toBe ""

      it "auto-indents selection when autoIndent is called", ->
        editSession.setCursorBufferPosition([2, 0])
        editSession.insertText("    0\n  2\n4\n")

        editSession.setSelectedBufferRange([[2, 0], [4, 0]])
        editSession.autoIndentSelectedRows()

        expect(editSession.lineForBufferRow(2)).toBe "    0"
        expect(editSession.lineForBufferRow(3)).toBe "    2"
        expect(editSession.lineForBufferRow(4)).toBe "4"

    describe "editor.autoIndentOnPaste", ->
      describe "when the text contains multiple lines", ->

          editSession.insertText('holy cow')
          expect(editSession.lineForScreenRow(2).fold).toBeUndefined()

      xdescribe "when the `normalizeIndent` option is true", ->
        describe "when the inserted text contains no newlines", ->
          it "does not adjust the indentation level of the text", ->
