mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Shim ::setWidth and ::getWidth to TextEditorElement
This commit is contained in:
@@ -856,6 +856,13 @@ class TextEditorComponent
|
||||
|
||||
{top, left, bottom, right}
|
||||
|
||||
setWidth: (width) ->
|
||||
@domNode.style.width = (width + @presenter.getGutterWidth()) + "px"
|
||||
@measureDimensions()
|
||||
|
||||
getWidth: ->
|
||||
@domNode.offsetWidth - @presenter.getGutterWidth()
|
||||
|
||||
getModel: ->
|
||||
@editor
|
||||
|
||||
|
||||
@@ -286,6 +286,12 @@ class TextEditorElement extends HTMLElement
|
||||
pixelRangeForScreenRange: (screenRange) ->
|
||||
@component.pixelRangeForScreenRange(screenRange)
|
||||
|
||||
setWidth: (width) ->
|
||||
@component.setWidth(width)
|
||||
|
||||
getWidth: ->
|
||||
@component.getWidth()
|
||||
|
||||
stopEventPropagation = (commandListeners) ->
|
||||
newCommandListeners = {}
|
||||
for commandName, commandListener of commandListeners
|
||||
|
||||
@@ -1015,6 +1015,9 @@ class TextEditorPresenter
|
||||
@gutterWidth = gutterWidth
|
||||
@updateOverlaysState()
|
||||
|
||||
getGutterWidth: ->
|
||||
@gutterWidth
|
||||
|
||||
setLineHeight: (lineHeight) ->
|
||||
unless @lineHeight is lineHeight
|
||||
@lineHeight = lineHeight
|
||||
|
||||
@@ -2987,8 +2987,16 @@ class TextEditor extends Model
|
||||
|
||||
getClientHeight: -> @displayBuffer.getClientHeight()
|
||||
|
||||
setWidth: (width) -> @displayBuffer.setWidth(width)
|
||||
getWidth: -> @displayBuffer.getWidth()
|
||||
setWidth: (width, reentrant=false) ->
|
||||
if reentrant
|
||||
@displayBuffer.setWidth(width)
|
||||
else
|
||||
Grim.deprecate("This is now a view method. Call TextEditorElement::setWidth instead.")
|
||||
atom.views.getView(this).setWidth(width)
|
||||
|
||||
getWidth: ->
|
||||
Grim.deprecate("This is now a view method. Call TextEditorElement::getWidth instead.")
|
||||
atom.views.getView(this).getWidth()
|
||||
|
||||
getScrollRow: -> @scrollRow
|
||||
setScrollRow: (@scrollRow) ->
|
||||
|
||||
Reference in New Issue
Block a user