Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Fix ::isModified for unsaved buffers - #118

Merged
nathansobo merged 4 commits into
masterfrom
as-fix-unsaved-buffer-ismodified
Dec 8, 2015
Merged

nathansobo merged 4 commits into
masterfrom
as-fix-unsaved-buffer-ismodified

Conversation

@as-cii

@as-cii as-cii commented Dec 8, 2015

Copy link
Copy Markdown
Contributor

While trying to break atom/atom#9968, I noticed that after instantiating a TextBuffer without passing load: true when the buffer hadn't a file path (i.e. which is what happens when deserializing an untitled editor) caused TextBuffer::isModified to alter its behavior, thereby always returning false.

I think there was a misplaced guard clause in the ::isModified method and I moved it, changing two existing specs to clarify this behavior, which now seems consistent also with the documentation:

# Public: Determine if the in-memory contents of the buffer differ from its
# contents on disk.
#
# If the buffer is unsaved, always returns `true` unless the buffer is empty.
#
# Returns a {Boolean}.

/cc: @nathansobo @maxbrunsfeld for 👀

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

👍

nathansobo pushed a commit that referenced this pull request Dec 8, 2015
@nathansobo
nathansobo merged commit 78f7c06 into master Dec 8, 2015
@nathansobo
nathansobo deleted the as-fix-unsaved-buffer-ismodified branch December 8, 2015 21:42
@nathansobo

Copy link
Copy Markdown
Contributor

@as-cii You should have publish access on this module now, so I'll let you take care of upgrading.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants