Rename singleTrailingNewline to ensureSingleTrailingNewline

This commit is contained in:
probablycorey
2013-04-01 09:51:10 -07:00
parent 66044175cc
commit ecb159738f
4 changed files with 11 additions and 11 deletions

View File

@@ -173,8 +173,8 @@ its own namespace.
- showInvisibles: Whether to render placeholders for invisible characters (defaults to false)
- fuzzyFinder
- ignoredNames: Files to ignore *only* in the fuzzy-finder
- stripTrailingWhitespace
- singleTrailingNewline: Whether to reduce multiple newlines to one at the end of files
- whitespace
- ensureSingleTrailingNewline: Whether to reduce multiple newlines to one at the end of files
- wrapGuide
- columns: Array of hashes with a `pattern` and `column` key to match the
the path of the current editor to a column position.

View File

@@ -81,8 +81,8 @@ describe "CSON", ->
fontSize: 20
core:
themes: ['a', 'b']
stripTrailingWhitespace:
singleTrailingNewline: true
whitespace:
ensureSingleTrailingNewline: true
cson = CSON.stringify(object)
CoffeeScript = require 'coffee-script'

View File

@@ -3,14 +3,14 @@ module.exports =
rootView.eachBuffer (buffer) => @whitespaceBeforeSave(buffer)
configDefaults:
singleTrailingNewline: true
ensureSingleTrailingNewline: true
whitespaceBeforeSave: (buffer) ->
buffer.on 'will-be-saved', ->
buffer.transact ->
buffer.scan /[ \t]+$/g, (match, range, { replace }) -> replace('')
if config.get('whitespace.singleTrailingNewline')
if config.get('whitespace.ensureSingleTrailingNewline')
if buffer.getLastLine() is ''
row = buffer.getLastRow() - 1
while row and buffer.lineForRow(row) is ''

View File

@@ -37,14 +37,14 @@ describe "Whitespace", ->
editor.getBuffer().save()
expect(editor.getText()).toBe 'Some text.\n'
describe "whitespace.singleTrailingNewline config", ->
describe "whitespace.ensureSingleTrailingNewline config", ->
[originalConfigValue] = []
beforeEach ->
originalConfigValue = config.get("whitespace.singleTrailingNewline")
originalConfigValue = config.get("whitespace.ensureSingleTrailingNewline")
expect(originalConfigValue).toBe true
afterEach ->
config.set("whitespace.singleTrailingNewline", originalConfigValue)
config.set("whitespace.ensureSingleTrailingNewline", originalConfigValue)
config.update()
it "adds a trailing newline when there is no trailing newline", ->
@@ -72,8 +72,8 @@ describe "Whitespace", ->
editor.getBuffer().save()
expect(editor.getText()).toBe "\n"
it "does not add trailing newline if singleTrailingNewline is false", ->
config.set("whitespace.singleTrailingNewline", false)
it "does not add trailing newline if ensureSingleTrailingNewline is false", ->
config.set("whitespace.ensureSingleTrailingNewline", false)
config.update()
editor.insertText "no trailing newline"