Add 1 pixel to scrollWidth to account for cursor if not soft-wrapped

This commit is contained in:
Nathan Sobo
2015-01-19 15:20:04 -07:00
parent 2296d2d378
commit ac463143dd
2 changed files with 52 additions and 40 deletions

View File

@@ -13,6 +13,7 @@ class TextEditorPresenter
subscribeToModel: ->
@disposables.add @model.onDidChange(@updateLinesState.bind(this))
@disposables.add @model.onDidChangeSoftWrapped(@updateLinesState.bind(this))
buildLinesState: ->
@state.lines = {}
@@ -63,7 +64,9 @@ class TextEditorPresenter
Math.min(@model.getScreenLineCount(), endRow)
getScrollWidth: ->
Math.max(@model.getMaxScreenLineLength() * @baseCharacterWidth, @clientWidth)
contentWidth = @model.getMaxScreenLineLength() * @baseCharacterWidth
contentWidth += 1 unless @model.isSoftWrapped() # account for cursor width
Math.max(contentWidth, @clientWidth)
setScrollTop: (@scrollTop) ->
@updateLinesState()