Remove duplicate package

This commit is contained in:
Kevin Sawicki
2012-12-18 22:16:17 -08:00
parent 22d4c679f5
commit 9ab75fd09b
3 changed files with 0 additions and 58 deletions

View File

@@ -1 +0,0 @@
module.exports = require 'single-trailing-newline/src/single-trailing-newline'

View File

@@ -1,39 +0,0 @@
SingleTrailingNewline = require 'single-trailing-newline'
RootView = require 'root-view'
fs = require 'fs'
describe "SingleTrailingNewline", ->
[rootView, editor, path] = []
beforeEach ->
path = "/tmp/atom-whitespace.txt"
fs.write(path, "")
rootView = new RootView(path)
SingleTrailingNewline.activate(rootView)
rootView.focus()
editor = rootView.getActiveEditor()
afterEach ->
fs.remove(path) if fs.exists(path)
rootView.remove()
it "adds a trailing newline when there is no trailing newline", ->
editor.insertText "foo"
editor.save()
expect(editor.getText()).toBe "foo\n"
it "removes extra trailing newlines and only keeps one", ->
editor.insertText "foo\n\n\n\n"
editor.save()
expect(editor.getText()).toBe "foo\n"
it "leaves a buffer with a single trailing newline untouched", ->
editor.insertText "foo\nbar\n"
editor.save()
expect(editor.getText()).toBe "foo\nbar\n"
it "leaves an empty buffer untouched", ->
editor.insertText ""
editor.save()
expect(editor.getText()).toBe ""

View File

@@ -1,18 +0,0 @@
module.exports =
name: "Add a single trailing newline"
activate: (rootView) ->
for buffer in rootView.project.getBuffers()
@addSingleTrailingNewlineBeforeSave(buffer)
rootView.project.on 'new-buffer', (buffer) =>
@addSingleTrailingNewlineBeforeSave(buffer)
addSingleTrailingNewlineBeforeSave: (buffer) ->
buffer.on 'before-save', ->
if buffer.getLastLine() is ''
row = buffer.getLastRow()
while row and buffer.lineForRow(--row) is ''
buffer.deleteRow(row)
else
buffer.append('\n')