mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Return default value of true from TextEditor.getAutoHeight
When we need to check for unassigned in the deprecated code path, we can just read the instance variable directly to avoid getting the deafult. Signed-off-by: Antonio Scandurra <as-cii@github.com>
This commit is contained in:
parent
106621e161
commit
13c00995d4
@ -5507,8 +5507,8 @@ describe "TextEditor", ->
|
||||
expect(editor.getScrollPastEnd()).toBe(false)
|
||||
|
||||
describe "auto height", ->
|
||||
it "returns undefined by default but can be customized", ->
|
||||
expect(editor.getAutoHeight()).toBeUndefined()
|
||||
it "returns true by default but can be customized", ->
|
||||
expect(editor.getAutoHeight()).toBe(true)
|
||||
editor.update({autoHeight: false})
|
||||
expect(editor.getAutoHeight()).toBe(false)
|
||||
editor.update({autoHeight: true})
|
||||
|
@ -57,7 +57,7 @@ class TextEditorComponent
|
||||
cursorBlinkResumeDelay: @cursorBlinkResumeDelay
|
||||
stoppedScrollingDelay: 200
|
||||
lineTopIndex: lineTopIndex
|
||||
autoHeight: @editor.getAutoHeight() ? true
|
||||
autoHeight: @editor.getAutoHeight()
|
||||
|
||||
@presenter.onDidUpdateState(@requestUpdate)
|
||||
|
||||
@ -759,7 +759,7 @@ class TextEditorComponent
|
||||
# auto-height in certain circumstances. This is legacy behavior that we
|
||||
# would rather not implement, but we can't remove it without risking
|
||||
# breakage currently.
|
||||
unless @editor.getAutoHeight()?
|
||||
unless @editor.autoHeight?
|
||||
{position, top, bottom} = getComputedStyle(@hostElement)
|
||||
hasExplicitTopAndBottom = (position is 'absolute' and top isnt 'auto' and bottom isnt 'auto')
|
||||
|
||||
|
@ -3542,7 +3542,7 @@ class TextEditor extends Model
|
||||
Grim.deprecate("This is now a view method. Call TextEditorElement::getHeight instead.")
|
||||
@height
|
||||
|
||||
getAutoHeight: -> @autoHeight
|
||||
getAutoHeight: -> @autoHeight ? true
|
||||
|
||||
setWidth: (width, reentrant=false) ->
|
||||
if reentrant
|
||||
|
Loading…
Reference in New Issue
Block a user