mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Set content.indentGuidesVisible in presenter if editor is mini
This commit is contained in:
@@ -167,6 +167,16 @@ describe "TextEditorPresenter", ->
|
||||
expectStateUpdate presenter, -> editor.setGrammar(atom.grammars.selectGrammar('.txt'))
|
||||
expect(presenter.state.content.indentGuidesVisible).toBe false
|
||||
|
||||
it "is always false when the editor is mini", ->
|
||||
atom.config.set('editor.showIndentGuide', true)
|
||||
editor.setMini(true)
|
||||
presenter = new TextEditorPresenter(model: editor)
|
||||
expect(presenter.state.content.indentGuidesVisible).toBe false
|
||||
editor.setMini(false)
|
||||
expect(presenter.state.content.indentGuidesVisible).toBe true
|
||||
editor.setMini(true)
|
||||
expect(presenter.state.content.indentGuidesVisible).toBe false
|
||||
|
||||
describe ".backgroundColor", ->
|
||||
it "is assigned to ::backgroundColor unless the editor is mini", ->
|
||||
presenter = new TextEditorPresenter(model: editor, backgroundColor: 'rgba(255, 0, 0, 0)')
|
||||
|
||||
@@ -184,7 +184,7 @@ LinesComponent = React.createClass
|
||||
lineIsWhitespaceOnly = firstTrailingWhitespacePosition is 0
|
||||
for token in tokens
|
||||
innerHTML += @updateScopeStack(scopeStack, token.scopes)
|
||||
hasIndentGuide = not editor.isMini() and indentGuidesVisible and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and lineIsWhitespaceOnly))
|
||||
hasIndentGuide = indentGuidesVisible and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and lineIsWhitespaceOnly))
|
||||
innerHTML += token.getValueAsHtml({hasIndentGuide})
|
||||
|
||||
innerHTML += @popScope(scopeStack) while scopeStack.length > 0
|
||||
|
||||
@@ -74,7 +74,7 @@ class TextEditorPresenter
|
||||
updateContentState: ->
|
||||
@state.content.scrollWidth = @computeScrollWidth()
|
||||
@state.content.scrollLeft = @getScrollLeft()
|
||||
@state.content.indentGuidesVisible = atom.config.get('editor.showIndentGuide', scope: @model.getRootScopeDescriptor())
|
||||
@state.content.indentGuidesVisible = not @model.isMini() and atom.config.get('editor.showIndentGuide', scope: @model.getRootScopeDescriptor())
|
||||
@state.content.backgroundColor = if @model.isMini() then null else @getBackgroundColor()
|
||||
@emitter.emit 'did-update-state'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user