From 8a0d029ad1036286481c281f3fc09d9aa975c21c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 17 Sep 2015 16:34:57 +0200 Subject: [PATCH] :art: Rename to ::onWillNeedMeasurements --- spec/text-editor-presenter-spec.coffee | 6 +++--- src/text-editor-component.coffee | 2 +- src/text-editor-presenter.coffee | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 5b2e6d78d..4f662294e 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -224,12 +224,12 @@ describe "TextEditorPresenter", -> presenter = buildPresenter() expectNoStateUpdate presenter, -> presenter.getState() - it "triggers ::onWillMeasure events before computing any state that needs measurement", -> + it "triggers ::onWillNeedMeasurements events before computing any state that needs measurement", -> editor.setCursorBufferPosition([0, 0]) cursorLine = editor.tokenizedLineForScreenRow(0) called = false - onWillMeasureSpy = (state) -> + onWillNeedMeasurementsSpy = (state) -> called = true expect(Object.keys(state.content.tiles).length).toBeGreaterThan(0) for tile, tileState of state.content.tiles @@ -245,7 +245,7 @@ describe "TextEditorPresenter", -> presenter = buildPresenter(explicitHeight: 6, scrollTop: 0, lineHeight: 1, tileSize: 2) - presenter.onWillMeasure(onWillMeasureSpy) + presenter.onWillNeedMeasurements(onWillNeedMeasurementsSpy) presenter.getState() expect(called).toBe(true) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 7dc3468cb..b2f8e0b92 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -83,7 +83,7 @@ class TextEditorComponent @linesYardstick = new LinesYardstick(@editor, this) @presenter.setLinesYardstick(@linesYardstick) - @presenter.onWillMeasure(@updateLinesComponentSync) + @presenter.onWillNeedMeasurements(@updateLinesComponentSync) @horizontalScrollbarComponent = new ScrollbarComponent({orientation: 'horizontal', onScroll: @onHorizontalScroll}) @scrollViewNode.appendChild(@horizontalScrollbarComponent.getDomNode()) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 1aed3c342..f4986fe6a 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -44,8 +44,8 @@ class TextEditorPresenter @disposables.dispose() # Calls your `callback` while performing ::getState(), before computing any state that needs measurements. - onWillMeasure: (callback) -> - @emitter.on "will-measure", callback + onWillNeedMeasurements: (callback) -> + @emitter.on "will-need-measurements", callback # Calls your `callback` when some changes in the model occurred and the current state has been updated. onDidUpdateState: (callback) -> @@ -82,7 +82,7 @@ class TextEditorPresenter @updateLinesDecorations() if @shouldUpdateDecorations @updateTilesState() if @shouldUpdateLinesState or @shouldUpdateLineNumbersState - @emitter.emit "will-measure", @state + @emitter.emit "will-need-measurements", @state @updateCommonGutterState() @updateHorizontalDimensions()