Permalink
Browse files

Remove the texteditor isModified/isReadOnly handling intended for uns…

…avable edit buffers as causes issues with vim-mode-plus
  • Loading branch information...
damieng authored and kuychaco committed Dec 13, 2017
1 parent 5fcf514 commit 4290fca3fe67138026a9a3d1e1610366870bd4cb
Showing with 1 addition and 24 deletions.
  1. +0 −17 spec/text-editor-spec.js
  2. +1 −7 src/text-editor.js
View
@@ -86,23 +86,6 @@ describe('TextEditor', () => {
})
})
describe('when the editor is readonly', () => {
it('overrides TextBuffer.isModified to return false', async () => {
const editor = await atom.workspace.open(null, {readOnly: true})
editor.setText('I am altering the buffer, pray I do not alter it any further')
expect(editor.isModified()).toBe(false)
editor.setReadOnly(false)
expect(editor.isModified()).toBe(true)
})
it('clears the readonly status when saved', async () => {
const editor = await atom.workspace.open(null, {readOnly: true})
editor.setText('I am altering the buffer, pray I do not alter it any further')
expect(editor.isReadOnly()).toBe(true)
await editor.saveAs(temp.openSync('was-readonly').path)
expect(editor.isReadOnly()).toBe(false)
})
})
describe('.copy()', () => {
it('returns a different editor with the same initial state', () => {
expect(editor.getAutoHeight()).toBeFalsy()
View
@@ -407,7 +407,6 @@ class TextEditor {
if (this.component != null) {
this.component.scheduleUpdate()
}
this.buffer.emitModifiedStatusChanged(this.isModified())
}
break
@@ -568,11 +567,6 @@ class TextEditor {
this.disposables.add(this.buffer.onDidChangeModified(() => {
if (!this.hasTerminatedPendingState && this.buffer.isModified()) this.terminatePendingState()
}))
this.disposables.add(this.buffer.onDidSave(() => {
if (this.isReadOnly()) {
this.setReadOnly(false)
}
}))
}
terminatePendingState () {
@@ -1129,7 +1123,7 @@ class TextEditor {
setEncoding (encoding) { this.buffer.setEncoding(encoding) }
// Essential: Returns {Boolean} `true` if this editor has been modified.
isModified () { return this.isReadOnly() ? false : this.buffer.isModified() }
isModified () { return this.buffer.isModified() }
// Essential: Returns {Boolean} `true` if this editor has no content.
isEmpty () { return this.buffer.isEmpty() }

0 comments on commit 4290fca

Please sign in to comment.