diff --git a/CHANGELOG.md b/CHANGELOG.md index 160742b06b8..31a2220c775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Fixed: Error when inserting newlines in CSS + * Improved: cmd-n now opens a new tab and cmd-shift-n now opens a new window. * Added: Inspect Element context menu * Fixed: Save As dialog now defaults to directory path of current editor diff --git a/spec/app/language-mode-spec.coffee b/spec/app/language-mode-spec.coffee index cb1e7eda40a..4929693980f 100644 --- a/spec/app/language-mode-spec.coffee +++ b/spec/app/language-mode-spec.coffee @@ -341,3 +341,14 @@ describe "LanguageMode", -> fold2 = editSession.lineForScreenRow(5).fold expect(fold2).toBeFalsy() + + describe "css", -> + beforeEach -> + atom.activatePackage('source-tmbundle', sync: true) + atom.activatePackage('css-tmbundle', sync: true) + editSession = project.open('css.css', autoIndent: true) + + describe "suggestedIndentForBufferRow", -> + it "does not return negative values (regression)", -> + editSession.setText('.test {\npadding: 0;\n}') + expect(editSession.suggestedIndentForBufferRow(2)).toBe 0 diff --git a/src/app/language-mode.coffee b/src/app/language-mode.coffee index 2112175451a..90192546e21 100644 --- a/src/app/language-mode.coffee +++ b/src/app/language-mode.coffee @@ -232,7 +232,7 @@ class LanguageMode return desiredIndentLevel unless decreaseIndentRegex = @decreaseIndentRegexForScopes(scopes) desiredIndentLevel -= 1 if decreaseIndentRegex.test(currentLine) - desiredIndentLevel + Math.max(desiredIndentLevel, 0) # Calculate a minimum indent level for a range of lines excluding empty lines. #