Skip to content

Commit

Permalink
🎨 Rename to ::onDidRequestAutoscroll
Browse files Browse the repository at this point in the history
  • Loading branch information
as-cii committed Sep 25, 2015
1 parent b0d70a6 commit ce714b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions spec/display-buffer-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1220,9 +1220,9 @@ describe "DisplayBuffer", ->
expect(displayBuffer.getDecorations(class: 'one').length).toEqual 1

describe "::scrollToScreenPosition(position, [options])", ->
it "triggers ::onDidChangeScrollPosition with the logical coordinates along with the options", ->
scrollSpy = jasmine.createSpy("::onDidChangeScrollPosition")
displayBuffer.onDidChangeScrollPosition(scrollSpy)
it "triggers ::onDidRequestAutoscroll with the logical coordinates along with the options", ->
scrollSpy = jasmine.createSpy("::onDidRequestAutoscroll")
displayBuffer.onDidRequestAutoscroll(scrollSpy)

displayBuffer.scrollToScreenPosition([8, 20])
displayBuffer.scrollToScreenPosition([8, 20], center: true)
Expand Down
2 changes: 1 addition & 1 deletion src/display-buffer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class DisplayBuffer extends Model
onDidChangeCharacterWidths: (callback) ->
@emitter.on 'did-change-character-widths', callback

onDidChangeScrollPosition: (callback) ->
onDidRequestAutoscroll: (callback) ->
@emitter.on 'did-change-scroll-position', callback

observeDecorations: (callback) ->
Expand Down
6 changes: 2 additions & 4 deletions src/text-editor-presenter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ class TextEditorPresenter

@disposables.add @model.onDidAddDecoration(@didAddDecoration.bind(this))
@disposables.add @model.onDidAddCursor(@didAddCursor.bind(this))
@disposables.add @model.onDidChangeScrollPosition(@didChangeScrollPosition.bind(this))
# @disposables.add @model.onDidChangeScrollTop(@setScrollTop.bind(this))
# @disposables.add @model.onDidChangeScrollLeft(@setScrollLeft.bind(this))
@disposables.add @model.onDidRequestAutoscroll(@requestAutoscroll.bind(this))
@observeDecoration(decoration) for decoration in @model.getDecorations()
@observeCursor(cursor) for cursor in @model.getCursors()
@disposables.add @model.onDidAddGutter(@didAddGutter.bind(this))
Expand Down Expand Up @@ -1474,7 +1472,7 @@ class TextEditorPresenter
@startBlinkingCursorsAfterDelay()
@emitDidUpdateState()

didChangeScrollPosition: (position) ->
requestAutoscroll: (position) ->
@pendingScrollLogicalPosition = position
@pendingScrollTop = null
@pendingScrollLeft = null
Expand Down
4 changes: 2 additions & 2 deletions src/text-editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ class TextEditor extends Model

atom.views.getView(this).onDidChangeScrollLeft(callback)

onDidChangeScrollPosition: (callback) ->
@displayBuffer.onDidChangeScrollPosition(callback)
onDidRequestAutoscroll: (callback) ->
@displayBuffer.onDidRequestAutoscroll(callback)

# TODO Remove once the tabs package no longer uses .on subscriptions
onDidChangeIcon: (callback) ->
Expand Down

0 comments on commit ce714b9

Please sign in to comment.