mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Add 1 pixel to scrollWidth to account for cursor if not soft-wrapped
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user