From 1463266b84af090311e05ef03312befbd40104e0 Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Sat, 5 Sep 2015 09:19:26 +0200 Subject: [PATCH] :fire: Remove deprecations from DisplayBuffer --- src/display-buffer.coffee | 74 +++++++-------------------------------- 1 file changed, 12 insertions(+), 62 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 5d5628689..4de0ab805 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -2,7 +2,6 @@ _ = require 'underscore-plus' Serializable = require 'serializable' {CompositeDisposable, Emitter} = require 'event-kit' {Point, Range} = require 'text-buffer' -Grim = require 'grim' TokenizedBuffer = require './tokenized-buffer' RowMap = require './row-map' Fold = require './fold' @@ -157,11 +156,9 @@ class DisplayBuffer extends Model @emitter.on 'did-update-markers', callback emitDidChange: (eventProperties, refreshMarkers=true) -> - @emit 'changed', eventProperties if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', eventProperties if refreshMarkers @refreshMarkerScreenPositions() - @emit 'markers-updated' if Grim.includeDeprecatedAPIs @emitter.emit 'did-update-markers' updateWrappedScreenLines: -> @@ -319,7 +316,6 @@ class DisplayBuffer extends Model characterWidthsChanged: -> @computeScrollWidth() - @emit 'character-widths-changed', @scopedCharacterWidthsChangeCount if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-character-widths', @scopedCharacterWidthsChangeCount clearScopedCharWidths: -> @@ -437,7 +433,6 @@ class DisplayBuffer extends Model @softWrapped = softWrapped @updateWrappedScreenLines() softWrapped = @isSoftWrapped() - @emit 'soft-wrap-changed', softWrapped if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-soft-wrapped', softWrapped softWrapped else @@ -999,7 +994,6 @@ class DisplayBuffer extends Model @decorationsByMarkerId[marker.id].push(decoration) @overlayDecorationsById[decoration.id] = decoration if decoration.isType('overlay') @decorationsById[decoration.id] = decoration - @emit 'decoration-added', decoration if Grim.includeDeprecatedAPIs @emitter.emit 'did-add-decoration', decoration decoration @@ -1011,7 +1005,6 @@ class DisplayBuffer extends Model if index > -1 decorations.splice(index, 1) delete @decorationsById[decoration.id] - @emit 'decoration-removed', decoration if Grim.includeDeprecatedAPIs @emitter.emit 'did-remove-decoration', decoration delete @decorationsByMarkerId[marker.id] if decorations.length is 0 delete @overlayDecorationsById[decoration.id] @@ -1310,7 +1303,6 @@ class DisplayBuffer extends Model if marker = @getMarker(textBufferMarker.id) # The marker might have been removed in some other handler called before # this one. Only emit when the marker still exists. - @emit 'marker-created', marker if Grim.includeDeprecatedAPIs @emitter.emit 'did-create-marker', marker decorateFold: (fold) -> @@ -1339,57 +1331,15 @@ class DisplayBuffer extends Model atom.assert screenLinesCount is bufferLinesCount, "Display buffer line count out of sync with buffer", (error) -> error.metadata = {screenLinesCount, tokenizedLinesCount, bufferLinesCount} -if Grim.includeDeprecatedAPIs - DisplayBuffer.properties - softWrapped: null - editorWidthInChars: null - lineHeightInPixels: null - defaultCharWidth: null - height: null - width: null - scrollTop: 0 - scrollLeft: 0 - scrollWidth: 0 - verticalScrollbarWidth: 15 - horizontalScrollbarHeight: 15 - - EmitterMixin = require('emissary').Emitter - - DisplayBuffer::on = (eventName) -> - switch eventName - when 'changed' - Grim.deprecate("Use DisplayBuffer::onDidChange instead") - when 'grammar-changed' - Grim.deprecate("Use DisplayBuffer::onDidChangeGrammar instead") - when 'soft-wrap-changed' - Grim.deprecate("Use DisplayBuffer::onDidChangeSoftWrap instead") - when 'character-widths-changed' - Grim.deprecate("Use DisplayBuffer::onDidChangeCharacterWidths instead") - when 'decoration-added' - Grim.deprecate("Use DisplayBuffer::onDidAddDecoration instead") - when 'decoration-removed' - Grim.deprecate("Use DisplayBuffer::onDidRemoveDecoration instead") - when 'decoration-changed' - Grim.deprecate("Use decoration.getMarker().onDidChange() instead") - when 'decoration-updated' - Grim.deprecate("Use Decoration::onDidChangeProperties instead") - when 'marker-created' - Grim.deprecate("Use Decoration::onDidCreateMarker instead") - when 'markers-updated' - Grim.deprecate("Use Decoration::onDidUpdateMarkers instead") - else - Grim.deprecate("DisplayBuffer::on is deprecated. Use event subscription methods instead.") - - EmitterMixin::on.apply(this, arguments) -else - DisplayBuffer::softWrapped = null - DisplayBuffer::editorWidthInChars = null - DisplayBuffer::lineHeightInPixels = null - DisplayBuffer::defaultCharWidth = null - DisplayBuffer::height = null - DisplayBuffer::width = null - DisplayBuffer::scrollTop = 0 - DisplayBuffer::scrollLeft = 0 - DisplayBuffer::scrollWidth = 0 - DisplayBuffer::verticalScrollbarWidth = 15 - DisplayBuffer::horizontalScrollbarHeight = 15 +DisplayBuffer.properties + softWrapped: null + editorWidthInChars: null + lineHeightInPixels: null + defaultCharWidth: null + height: null + width: null + scrollTop: 0 + scrollLeft: 0 + scrollWidth: 0 + verticalScrollbarWidth: 15 + horizontalScrollbarHeight: 15