Merge branch 'master' into as-block-decorations

This commit is contained in:
Antonio Scandurra
2016-01-14 09:30:06 -07:00
42 changed files with 391 additions and 191 deletions

View File

@@ -92,7 +92,7 @@ class TextEditor extends Model
softWrapped, @displayBuffer, @selectionsMarkerLayer, buffer, suppressCursorCreation,
@mini, @placeholderText, lineNumberGutterVisible, largeFileMode, @config,
@notificationManager, @packageManager, @clipboard, @viewRegistry, @grammarRegistry,
@project, @assert, @applicationDelegate
@project, @assert, @applicationDelegate, @pending
} = params
throw new Error("Must pass a config parameter when constructing TextEditors") unless @config?
@@ -161,6 +161,9 @@ class TextEditor extends Model
@disposables.add @buffer.onDidChangeEncoding =>
@emitter.emit 'did-change-encoding', @getEncoding()
@disposables.add @buffer.onDidDestroy => @destroy()
if @pending
@disposables.add @buffer.onDidChangeModified =>
@terminatePendingState() if @buffer.isModified()
@preserveCursorPositionOnBufferReload()
@@ -569,6 +572,13 @@ class TextEditor extends Model
getEditorWidthInChars: ->
@displayBuffer.getEditorWidthInChars()
onDidTerminatePendingState: (callback) ->
@emitter.on 'did-terminate-pending-state', callback
terminatePendingState: ->
@pending = false
@emitter.emit 'did-terminate-pending-state', this
###
Section: File Details
###
@@ -652,9 +662,13 @@ class TextEditor extends Model
# Essential: Returns {Boolean} `true` if this editor has no content.
isEmpty: -> @buffer.isEmpty()
# Returns {Boolean} `true` if this editor is pending and `false` if it is permanent.
isPending: -> Boolean(@pending)
# Copies the current file path to the native clipboard.
copyPathToClipboard: ->
copyPathToClipboard: (relative = false) ->
if filePath = @getPath()
filePath = atom.project.relativize(filePath) if relative
@clipboard.write(filePath)
###
@@ -3043,7 +3057,7 @@ class TextEditor extends Model
# Essential: Scrolls the editor to the given screen position.
#
# * `screenPosition` An object that represents a buffer position. It can be either
# * `screenPosition` An object that represents a screen position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
# * `options` (optional) {Object}
# * `center` Center the editor around the position if possible. (default: false)