diff --git a/spec/fake-lines-yardstick.coffee b/spec/fake-lines-yardstick.coffee index f01e6161b..888272295 100644 --- a/spec/fake-lines-yardstick.coffee +++ b/spec/fake-lines-yardstick.coffee @@ -27,7 +27,7 @@ class FakeLinesYardstick targetColumn = screenPosition.column baseCharacterWidth = @model.getDefaultCharWidth() - top = @lineTopIndex.pixelPositionForRow(targetRow) + top = @lineTopIndex.pixelPositionAfterBlocksForRow(targetRow) left = 0 column = 0 diff --git a/src/lines-yardstick.coffee b/src/lines-yardstick.coffee index 3be276412..88a836c60 100644 --- a/src/lines-yardstick.coffee +++ b/src/lines-yardstick.coffee @@ -84,7 +84,7 @@ class LinesYardstick targetRow = screenPosition.row targetColumn = screenPosition.column - top = @lineTopIndex.pixelPositionForRow(targetRow) + top = @lineTopIndex.pixelPositionAfterBlocksForRow(targetRow) left = @leftPixelPositionForScreenPosition(targetRow, targetColumn) {top, left} diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 470be8342..4104e5b01 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -349,8 +349,8 @@ class TextEditorPresenter continue if rowsWithinTile.length is 0 - top = Math.round(@lineTopIndex.pixelPositionForFirstBlockAtRow(tileStartRow)) - bottom = Math.round(@lineTopIndex.pixelPositionForFirstBlockAtRow(tileEndRow)) + top = Math.round(@lineTopIndex.pixelPositionBeforeBlocksForRow(tileStartRow)) + bottom = Math.round(@lineTopIndex.pixelPositionBeforeBlocksForRow(tileEndRow)) height = bottom - top tile = @state.content.tiles[tileStartRow] ?= {} @@ -557,8 +557,8 @@ class TextEditorPresenter continue unless @gutterIsVisible(gutter) for decorationId, {properties, screenRange} of @customGutterDecorationsByGutterName[gutterName] - top = @lineTopIndex.pixelPositionForRow(screenRange.start.row) - bottom = @lineTopIndex.pixelPositionForFirstBlockAtRow(screenRange.end.row + 1) + top = @lineTopIndex.pixelPositionAfterBlocksForRow(screenRange.start.row) + bottom = @lineTopIndex.pixelPositionBeforeBlocksForRow(screenRange.end.row + 1) @customGutterDecorations[gutterName][decorationId] = top: top height: bottom - top @@ -609,8 +609,8 @@ class TextEditorPresenter line = @model.tokenizedLineForScreenRow(screenRow) decorationClasses = @lineNumberDecorationClassesForRow(screenRow) foldable = @model.isFoldableAtScreenRow(screenRow) - blockDecorationsAfterPreviousScreenRowHeight = @lineTopIndex.pixelPositionForFirstBlockAtRow(screenRow) - @lineHeight - @lineTopIndex.pixelPositionForRow(screenRow - 1) - blockDecorationsBeforeCurrentScreenRowHeight = @lineTopIndex.pixelPositionForRow(screenRow) - @lineTopIndex.pixelPositionForFirstBlockAtRow(screenRow) + blockDecorationsAfterPreviousScreenRowHeight = @lineTopIndex.pixelPositionBeforeBlocksForRow(screenRow) - @lineHeight - @lineTopIndex.pixelPositionAfterBlocksForRow(screenRow - 1) + blockDecorationsBeforeCurrentScreenRowHeight = @lineTopIndex.pixelPositionAfterBlocksForRow(screenRow) - @lineTopIndex.pixelPositionBeforeBlocksForRow(screenRow) blockDecorationsHeight = blockDecorationsAfterPreviousScreenRowHeight + blockDecorationsBeforeCurrentScreenRowHeight tileState.lineNumbers[line.id] = {screenRow, bufferRow, softWrapped, decorationClasses, foldable, blockDecorationsHeight} @@ -664,7 +664,7 @@ class TextEditorPresenter updateVerticalDimensions: -> if @lineHeight? oldContentHeight = @contentHeight - @contentHeight = Math.round(@lineTopIndex.pixelPositionForRow(@model.getScreenLineCount())) + @contentHeight = Math.round(@lineTopIndex.pixelPositionAfterBlocksForRow(@model.getScreenLineCount())) if @contentHeight isnt oldContentHeight @updateHeight() @@ -1200,7 +1200,7 @@ class TextEditorPresenter screenRange.end.column = 0 repositionRegionWithinTile: (region, tileStartRow) -> - region.top += @scrollTop - @lineTopIndex.pixelPositionForFirstBlockAtRow(tileStartRow) + region.top += @scrollTop - @lineTopIndex.pixelPositionBeforeBlocksForRow(tileStartRow) region.left += @scrollLeft buildHighlightRegions: (screenRange) -> @@ -1397,7 +1397,7 @@ class TextEditorPresenter @emitDidUpdateState() didChangeFirstVisibleScreenRow: (screenRow) -> - @setScrollTop(@lineTopIndex.pixelPositionForRow(screenRow)) + @setScrollTop(@lineTopIndex.pixelPositionAfterBlocksForRow(screenRow)) getVerticalScrollMarginInPixels: -> Math.round(@model.getVerticalScrollMargin() * @lineHeight) @@ -1418,8 +1418,8 @@ class TextEditorPresenter verticalScrollMarginInPixels = @getVerticalScrollMarginInPixels() - top = @lineTopIndex.pixelPositionForRow(screenRange.start.row) - bottom = @lineTopIndex.pixelPositionForRow(screenRange.end.row) + @lineHeight + top = @lineTopIndex.pixelPositionAfterBlocksForRow(screenRange.start.row) + bottom = @lineTopIndex.pixelPositionAfterBlocksForRow(screenRange.end.row) + @lineHeight if options?.center desiredScrollCenter = (top + bottom) / 2 @@ -1491,7 +1491,7 @@ class TextEditorPresenter restoreScrollTopIfNeeded: -> unless @scrollTop? - @updateScrollTop(@lineTopIndex.pixelPositionForRow(@model.getFirstVisibleScreenRow())) + @updateScrollTop(@lineTopIndex.pixelPositionAfterBlocksForRow(@model.getFirstVisibleScreenRow())) restoreScrollLeftIfNeeded: -> unless @scrollLeft?