Clear ::mouseWheelScreenRow after delay even if we don’t actually scroll

This commit is contained in:
Nathan Sobo
2015-01-28 16:30:01 -07:00
parent 37a040a620
commit d9a5d141eb
2 changed files with 8 additions and 0 deletions

View File

@@ -383,9 +383,16 @@ describe "TextEditorPresenter", ->
expect(lineStateForScreenRow(presenter, 0)).toBeUndefined()
expect(lineStateForScreenRow(presenter, 1)).toBeUndefined()
expect(lineStateForScreenRow(presenter, 2)).toBeDefined()
expect(lineStateForScreenRow(presenter, 7)).toBeDefined()
expect(lineStateForScreenRow(presenter, 8)).toBeUndefined()
# should clear ::mouseWheelScreenRow after stoppedScrollingDelay elapses even if we don't scroll first
presenter.setMouseWheelScreenRow(2)
advanceClock(200)
expectStateUpdate presenter, -> presenter.setScrollTop(45)
expect(lineStateForScreenRow(presenter, 2)).toBeUndefined()
it "does not preserve on-screen lines even if they correspond to ::mouseWheelScreenRow", ->
presenter = new TextEditorPresenter(model: editor, clientHeight: 25, scrollTop: 0, lineHeight: 10, lineOverdrawMargin: 1, stoppedScrollingDelay: 200)
oldLine3 = editor.tokenizedLineForScreenRow(6)

View File

@@ -431,6 +431,7 @@ class TextEditorPresenter
getLineHeight: -> @lineHeight
setMouseWheelScreenRow: (@mouseWheelScreenRow) ->
@didStartScrolling()
getMouseWheelScreenRow: -> @mouseWheelScreenRow