mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Treat file-less buffers as unmodified when empty
This commit is contained in:
@@ -168,6 +168,19 @@ describe 'Buffer', ->
|
||||
buffer.save()
|
||||
expect(buffer.isModified()).toBe false
|
||||
|
||||
it "returns false for an empty buffer with no path", ->
|
||||
buffer.release()
|
||||
buffer = new Buffer()
|
||||
expect(buffer.isModified()).toBeFalsy()
|
||||
|
||||
it "returns true for a non-empty buffer with no path", ->
|
||||
buffer.release()
|
||||
buffer = new Buffer()
|
||||
buffer.setText('a')
|
||||
expect(buffer.isModified()).toBeTruthy()
|
||||
buffer.setText('\n')
|
||||
expect(buffer.isModified()).toBeTruthy()
|
||||
|
||||
describe ".getLines()", ->
|
||||
it "returns an array of lines in the text contents", ->
|
||||
expect(buffer.getLines().length).toBe fileContents.split("\n").length
|
||||
|
||||
@@ -241,7 +241,10 @@ class Buffer
|
||||
@trigger 'after-save'
|
||||
|
||||
isModified: ->
|
||||
@memoryContentSignature != @diskContentSignature
|
||||
if @file
|
||||
@memoryContentSignature != @diskContentSignature
|
||||
else
|
||||
@lines.length > 1 or @lines[0]
|
||||
|
||||
isInConflict: -> @conflict
|
||||
|
||||
|
||||
Reference in New Issue
Block a user