mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
@@ -77,6 +77,18 @@ describe "TextEditorPresenter", ->
|
||||
presenter.setExplicitHeight((editor.getLineCount() * 10) - 1)
|
||||
expect(state.horizontalScrollbar.visible).toBe true
|
||||
|
||||
it "is false if the editor is mini", ->
|
||||
presenter = buildPresenter
|
||||
explicitHeight: editor.getLineCount() * 10
|
||||
contentFrameWidth: editor.getMaxScreenLineLength() * 10 - 10
|
||||
baseCharacterWidth: 10
|
||||
|
||||
expect(presenter.state.horizontalScrollbar.visible).toBe true
|
||||
editor.setMini(true)
|
||||
expect(presenter.state.horizontalScrollbar.visible).toBe false
|
||||
editor.setMini(false)
|
||||
expect(presenter.state.horizontalScrollbar.visible).toBe true
|
||||
|
||||
describe ".height", ->
|
||||
it "tracks the value of ::horizontalScrollbarHeight", ->
|
||||
presenter = buildPresenter(horizontalScrollbarHeight: 10)
|
||||
|
||||
@@ -59,6 +59,8 @@ class TextEditorPresenter
|
||||
@disposables.add @model.onDidChangeGrammar(@updateContentState.bind(this))
|
||||
@disposables.add @model.onDidChangePlaceholderText(@updateContentState.bind(this))
|
||||
@disposables.add @model.onDidChangeMini =>
|
||||
@updateScrollbarDimensions()
|
||||
@updateScrollbarsState()
|
||||
@updateContentState()
|
||||
@updateDecorations()
|
||||
@updateLinesState()
|
||||
@@ -395,12 +397,14 @@ class TextEditorPresenter
|
||||
clientHeightWithHorizontalScrollbar = clientHeightWithoutHorizontalScrollbar - @measuredHorizontalScrollbarHeight
|
||||
|
||||
horizontalScrollbarVisible =
|
||||
@contentWidth > clientWidthWithoutVerticalScrollbar or
|
||||
@contentWidth > clientWidthWithVerticalScrollbar and @contentHeight > clientHeightWithoutHorizontalScrollbar
|
||||
not @model.isMini() and
|
||||
(@contentWidth > clientWidthWithoutVerticalScrollbar or
|
||||
@contentWidth > clientWidthWithVerticalScrollbar and @contentHeight > clientHeightWithoutHorizontalScrollbar)
|
||||
|
||||
verticalScrollbarVisible =
|
||||
@contentHeight > clientHeightWithoutHorizontalScrollbar or
|
||||
@contentHeight > clientHeightWithHorizontalScrollbar and @contentWidth > clientWidthWithoutVerticalScrollbar
|
||||
not @model.isMini() and
|
||||
(@contentHeight > clientHeightWithoutHorizontalScrollbar or
|
||||
@contentHeight > clientHeightWithHorizontalScrollbar and @contentWidth > clientWidthWithoutVerticalScrollbar)
|
||||
|
||||
horizontalScrollbarHeight =
|
||||
if horizontalScrollbarVisible
|
||||
|
||||
Reference in New Issue
Block a user