Add TextEditor::onDidChangeEncoding

This commit is contained in:
Kevin Sawicki
2014-10-28 11:31:27 -07:00
parent 35925ed349
commit d2ef888f22

View File

@@ -134,6 +134,8 @@ class TextEditor extends Model
@emitter.emit 'did-change-title', @getTitle()
@emit "path-changed"
@emitter.emit 'did-change-path', @getPath()
@subscribe @buffer.onDidChangeEncoding =>
@emitter.emit 'did-change-encoding', @getEncoding()
@subscribe @buffer.onDidDestroy => @destroy()
# TODO: remove these thwne we remove the deprecations. They are old events.
@@ -260,6 +262,14 @@ class TextEditor extends Model
onDidChangeSoftWrapped: (callback) ->
@displayBuffer.onDidChangeSoftWrapped(callback)
# Extended: Calls your `callback` when the buffer's encoding has changed.
#
# * `callback` {Function}
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidChangeEncoding: (callback) ->
@emitter.on 'did-change-encoding', callback
# Extended: Calls your `callback` when the grammar that interprets and
# colorizes the text has been changed. Immediately calls your callback with
# the current grammar.