From d2ef888f222e991be25910c356e8d83062054ea0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 28 Oct 2014 11:31:27 -0700 Subject: [PATCH] Add TextEditor::onDidChangeEncoding --- src/text-editor.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index e680fad8e..b0143ea71 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -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.