mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Merge branch 'stable' into beta
This commit is contained in:
@@ -7,6 +7,7 @@ class FakeLinesYardstick
|
||||
|
||||
prepareScreenRowsForMeasurement: ->
|
||||
@presenter.getPreMeasurementState()
|
||||
@screenRows = new Set(@presenter.getScreenRows())
|
||||
|
||||
getScopedCharacterWidth: (scopeNames, char) ->
|
||||
@getScopedCharacterWidths(scopeNames)[char]
|
||||
@@ -34,6 +35,8 @@ class FakeLinesYardstick
|
||||
left = 0
|
||||
column = 0
|
||||
|
||||
return {top, left: 0} unless @screenRows.has(screenPosition.row)
|
||||
|
||||
iterator = @model.tokenizedLineForScreenRow(targetRow).getTokenIterator()
|
||||
while iterator.next()
|
||||
characterWidths = @getScopedCharacterWidths(iterator.getScopes())
|
||||
|
||||
@@ -694,6 +694,20 @@ describe "TextEditorPresenter", ->
|
||||
presenter = buildPresenter(explicitHeight: 100, contentFrameWidth: 10 * maxLineLength + 20, baseCharacterWidth: 10, verticalScrollbarWidth: 10)
|
||||
expect(presenter.getState().content.scrollWidth).toBe 10 * maxLineLength + 20 - 10 # subtract vertical scrollbar width
|
||||
|
||||
describe "when the longest screen row is the first one and it's hidden", ->
|
||||
it "doesn't compute an invalid value (regression)", ->
|
||||
presenter = buildPresenter(tileSize: 2, contentFrameWidth: 10, explicitHeight: 20)
|
||||
editor.setText """
|
||||
a very long long long long long long line
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
"""
|
||||
|
||||
expectStateUpdate presenter, -> presenter.setScrollTop(40)
|
||||
expect(presenter.getState().content.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1
|
||||
|
||||
it "updates when the ::contentFrameWidth changes", ->
|
||||
maxLineLength = editor.getMaxScreenLineLength()
|
||||
presenter = buildPresenter(contentFrameWidth: 50, baseCharacterWidth: 10)
|
||||
|
||||
@@ -377,7 +377,8 @@ class TextEditorPresenter
|
||||
endRow = @constrainRow(@getEndTileRow() + @tileSize)
|
||||
|
||||
screenRows = [startRow...endRow]
|
||||
if longestScreenRow = @model.getLongestScreenRow()
|
||||
longestScreenRow = @model.getLongestScreenRow()
|
||||
if longestScreenRow?
|
||||
screenRows.push(longestScreenRow)
|
||||
if @screenRowsToMeasure?
|
||||
screenRows.push(@screenRowsToMeasure...)
|
||||
|
||||
Reference in New Issue
Block a user