mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Take the gutter width into account when sizing TextEditorElement
This commit is contained in:
@@ -129,7 +129,7 @@ class TextEditorComponent
|
||||
updateSync: ->
|
||||
@updateSyncPreMeasurement()
|
||||
|
||||
@oldState ?= {content: {}}
|
||||
@oldState ?= {width: null}
|
||||
@newState = @presenter.getPostMeasurementState()
|
||||
|
||||
if @editor.getLastSelection()? and not @editor.getLastSelection().isEmpty()
|
||||
@@ -149,14 +149,12 @@ class TextEditorComponent
|
||||
else
|
||||
@domNode.style.height = ''
|
||||
|
||||
if (@newState.content.autoWidth isnt @oldState.content.autoWidth) or (@newState.content.width isnt @oldState.content.width)
|
||||
if @newState.content.autoWidth
|
||||
@hostElement.style.width = @newState.content.width + 'px'
|
||||
else if @oldState.content.autoWidth
|
||||
if @newState.width isnt @oldState.width
|
||||
if @newState.width?
|
||||
@hostElement.style.width = @newState.width + 'px'
|
||||
else
|
||||
@hostElement.style.width = ''
|
||||
|
||||
@oldState.content.width = @newState.content.width
|
||||
@oldState.content.autoWidth = @newState.content.autoWidth
|
||||
@oldState.width = @newState.width
|
||||
|
||||
if @newState.gutters.length
|
||||
@mountGutterContainerComponent() unless @gutterContainerComponent?
|
||||
|
||||
@@ -110,13 +110,14 @@ class TextEditorPresenter
|
||||
|
||||
@updateLines()
|
||||
|
||||
@updateFocusedState()
|
||||
@updateHeightState()
|
||||
@updateVerticalScrollState()
|
||||
@updateHorizontalScrollState()
|
||||
@updateScrollbarsState()
|
||||
@updateHiddenInputState()
|
||||
@updateContentState()
|
||||
@updateFocusedState()
|
||||
@updateHeightState()
|
||||
@updateWidthState()
|
||||
@updateHighlightDecorations() if @shouldUpdateDecorations
|
||||
@updateTilesState()
|
||||
@updateCursorsState()
|
||||
@@ -224,6 +225,12 @@ class TextEditorPresenter
|
||||
else
|
||||
@state.height = null
|
||||
|
||||
updateWidthState: ->
|
||||
if @model.getAutoWidth()
|
||||
@state.width = @state.content.width + @gutterWidth
|
||||
else
|
||||
@state.width = null
|
||||
|
||||
updateVerticalScrollState: ->
|
||||
@state.content.scrollHeight = @scrollHeight
|
||||
@sharedGutterStyles.scrollHeight = @scrollHeight
|
||||
@@ -276,7 +283,6 @@ class TextEditorPresenter
|
||||
@state.content.width = contentWidth + verticalScrollbarWidth
|
||||
else
|
||||
@state.content.width = Math.max(contentWidth + verticalScrollbarWidth, contentFrameWidth)
|
||||
@state.content.autoWidth = @model.getAutoWidth()
|
||||
@state.content.scrollWidth = @scrollWidth
|
||||
@state.content.scrollLeft = @scrollLeft
|
||||
@state.content.backgroundColor = if @model.isMini() then null else @backgroundColor
|
||||
|
||||
Reference in New Issue
Block a user