Don't show indent guides for mini editors

This commit is contained in:
Antonio Scandurra
2016-05-01 11:42:28 +02:00
parent 4f5efe98ff
commit 1c694df03b
2 changed files with 17 additions and 2 deletions

View File

@@ -5967,6 +5967,20 @@ describe "TextEditor", ->
atom.config.set('editor.showInvisibles', true)
expect(editor.lineTextForScreenRow(0).indexOf(atom.config.get('editor.invisibles.eol'))).toBe(-1)
describe "indent guides", ->
it "shows indent guides when `editor.showIndentGuide` is set to true and the editor is not mini", ->
editor.setText(" foo")
atom.config.set('editor.tabLength', 2)
atom.config.set('editor.showIndentGuide', false)
expect(editor.tokensForScreenRow(0)).toEqual ['source.js', 'leading-whitespace']
atom.config.set('editor.showIndentGuide', true)
expect(editor.tokensForScreenRow(0)).toEqual ['source.js', 'leading-whitespace indent-guide']
editor.setMini(true)
expect(editor.tokensForScreenRow(0)).toEqual ['source.js', 'leading-whitespace']
describe "when the editor is constructed with the grammar option set", ->
beforeEach ->
atom.workspace.destroyActivePane()

View File

@@ -257,7 +257,7 @@ class TextEditor extends Model
@displayLayer.reset({
invisibles: @getInvisibles(),
softWrapColumn: @getSoftWrapColumn(),
showIndentGuides: @config.get('editor.showIndentGuide', scope: @getRootScopeDescriptor()),
showIndentGuides: not @isMini() and @config.get('editor.showIndentGuide', scope: @getRootScopeDescriptor()),
atomicSoftTabs: @config.get('editor.atomicSoftTabs', scope: @getRootScopeDescriptor()),
tabLength: @getTabLength(),
ratioForCharacter: @ratioForCharacter.bind(this),
@@ -589,7 +589,8 @@ class TextEditor extends Model
setMini: (mini) ->
if mini isnt @mini
@mini = mini
@setIgnoreInvisibles(@mini)
@ignoreInvisibles = @mini
@resetDisplayLayer()
@emitter.emit 'did-change-mini', @mini
@mini